Thumbnails of very large images
Posted: 2015-06-04T06:42:37-07:00
I am using imagemagick to create thumbnails of images uploaded by users to our webserver. Mostly, this works beautifully, thank you, developers. But users have been known to upload enormous images in various formats. That's ok, this is a print prepress operation, some of these images really do need to be enormous.
I have been using a line like this in my php code to trigger creation of small thumbnails on demand when a URL is accessed with an http GET:
When the input file is very big (I'm thinking of a 125Mbyte jpeg file) this takes a long time to execute on the slow LAMP server processor. If the http GET times out (after 75s on my browser), the PHP code gets killed.
* If the PHP code is killed, does that also send kill to convert?
* If kill is sent to convert, can that result in convert leaving files lying in /tmp?
I have seen instances where multiple files named magick... have been left in /tmp, each more than 1Gbyte in size. Eventually /tmp fills up and the server stops working until I fix it. I'm seeking any solution to this I can find, while still enabling users to see thumbnails of giant images.
This is a 1-processor LAMP server running ImageMagick 6.5.4-7 2014-02-10 Q16.
I've seen advice elsewhere on this forum to process large images with stream but that does not support -scale. Can I reduce image pixel count with stream? Is stream useful? Thanks!
I have been using a line like this in my php code to trigger creation of small thumbnails on demand when a URL is accessed with an http GET:
Code: Select all
system("convert $inputFile -resize $width x $height -colorspace RGB -profile sRGB.icm -strip $destinationFile 1> debug1.txt 2> debug2.txt", $systemreturn);
* If the PHP code is killed, does that also send kill to convert?
* If kill is sent to convert, can that result in convert leaving files lying in /tmp?
I have seen instances where multiple files named magick... have been left in /tmp, each more than 1Gbyte in size. Eventually /tmp fills up and the server stops working until I fix it. I'm seeking any solution to this I can find, while still enabling users to see thumbnails of giant images.
This is a 1-processor LAMP server running ImageMagick 6.5.4-7 2014-02-10 Q16.
I've seen advice elsewhere on this forum to process large images with stream but that does not support -scale. Can I reduce image pixel count with stream? Is stream useful? Thanks!