james438 wrote:Hi,
I am pretty new here, so please let me know if I am posting in the wrong place.
I am also new to ImageMagick as well and am casually trying to learn some of the basics. In the following example what does
jpg:- do?
Code: Select all
<?php
header( 'Content-Type: image/jpg' );
system("convert images/pops/gdsample1.jpg -flop jpg:-");
?>
In your specific case this PHP, outputs a bare minimum HTTP protocol header, followed but the image that the header indicates folows. This is typically run by the web server (like apache), which may add extra header items, then pass it to the client.
In other words calling the PHP script via a web client/browser, returns a JPG image, regardless of the image source format (though it is JPEG in this case), any extra modifications (-flop), and without needing a temprary file, or any save of the modified image to disk on the web server machine (client browsers would probably save it).
A good addition to this PHP script may be the inclusion of a 'timestamp' in the header based on the source image file timestamp (and the scripts own time stamp, whatever is newer), as the destination image will not change unless the source image or script changes. This prevents client browsers for needing to 'reload' the image when they already have a valid copy that does not change. Saves a lot of extra traffic and work on the both client and server machines!