The concept is simple enough but I have had to create a script to generate all the images. I’ve used PEAR Math Combinatorics to handle all the images configurations but that involved enabling ImageMagick on the server. What a struggle that’s been. Honestly, I couldn’t be a server admin, desperate stuff. Anyway….. Maybe this might help some other poor unfortunate like myself a few frustrating hours.
As usual with these server things (what is it with server guys/companies? It’s like they are deliberately keeping it all as complicated/variabel and undocumented as possible) you get to a step where you have no idea where to take it.
After Step 5 is says;
A imagick.so file will be created under /usr/lib/php/modules/ directory. Now, edit the php configuration file /etc/php.ini and add the following line after the “extension_dir” directive
extension = "imagick.so"
OK, great. So how do you do that then? Well first of all you may well be installing this on your own VPS that you are not exactly 100% familair wit, and depending on who you’ve hired it through the initial setup may have been done differently. in my /etc/php.ini file, which you can edit using vi and the command;
I then searched for the extensions_dir directive by doing;
Which takes you to the place in the file where that directive is set. Mine was commented out so I then I hit the i key to insert and added in the following (Plesk 11 VPS from Hetzner);
extension_dir = /usr/lib64/php/modules/ extension = "imagick.so"
You then save it by hitting Escape and typing;
OK, now we are back on track. Restart the server;
service httpd restart
So I’ve now got this working from the shell and also via exec(). But not directly throught he PHP classes. Hey ho. I will come back and update this post when I’ve managed to get that working, for the moment the script I am using can use exec(0 directly in the following style to generate a composite image);
exec('convert -page +0+0 /var/www/vhosts/mcnab-systems.com/subdomains/test/media/options_1_2.png -page +0+0 /var/www/vhosts/mcnab-systems.com/subdomains/test/media/options_2_2.png /var/www/vhosts/mcnab-systems.com/subdomains/test/media/grey_prod_background.png -layers merge +repage /var/www/vhosts/mcnab-systems.com/subdomains/67designs/media/merged-file.jpg');