PHP has the capacity to upload files such as documents or images using the multiple form-data protocol. Here’s the code to convert, scale and write out a scaled JPG image.
Code:
/*== where storing tmp img file ==*/
= tempnam("/tmp" "MKPH");
= "/scaled.jpg";
/*== CONVERT IMAGE TO PNM ==*/
if ( == "jpg") { system("djpeg >"); }
else { echo("Extension Unknown. Please only upload a JPEG image."); exit(); }
/*== scale image using pnmscale and output using cjpeg ==*/
system("pnmscale -xy 250 200 | cjpeg -smoo 10 -qual 50 >");
Bookmarks