ModX Revo
I form a big picture of hundreds of small, avatar users (to optimize the page load time - one picture weighing 100kB or 400 of 2kB is loaded - there is some difference)))
The request is banal and without incoming parameters select img_id from table where val=20 , get a sample img_id (this is the unicid name of small pictures).
Connection to the database is standard for the ModX snippet via $query = $modx->query($sql);
Then in the cycle through the GD-functions imagecreate, imagecopy, imagepng form one image
In my youth I made a code for generating a picture in the form of a snippet, I call the snippet in the template, the template is respectively linked to a specific page, the page is called via cron. I found by experience that the script runs for 15-20 seconds, while the query in the database is 0.05 seconds, the rest is PHP and probably adds something ModX itself.
I tried to issue as a separate php file with a connection to the database as in the good old days by specifying passwords inside the file, while I see that the final file is updated within a second (stupidly by the time the file changes to ftp). ModX, Carl?
What is the best way to do now, in order, as they say, to eat a fish and not get on a fence from stakes?))) Ie connect to the database without explicitly specifying passwords in the file and at the same time dispense with the bizarre API ModX. Run the specified code inside the snippet will probably have to be deleted.