I need to copy and resize an image to be a thumbnail. The server that I'm using my PHP on has a tool called NETPBM which can execute server side image editing. In this case, I'm trying to edit a JPEG image. This code works about half-way:
<?php
$image = "images/pic.jpg";
$thumb = "images/pic_small.jpg";
$binpath = "/path/to/netpbm/";
exec($binpath . "jpegtopnm " . $image . " | " . $binpath . "pnmscale - xysize 200 135 | " . $binpath . "pnmtojpeg -quality=75 > " . $thumb);
?>
What it does is: it will copy the image, rename the copied image appropriately ("pic_small.jpg"), but there will be no binary data in the image (size: 0kb; shows up as the little X-in-the-box when viewing in IE). Official Docs: http://netpbm.sourceforge.net/doc/. I've looked over the docs, still am, can't quite figure out what's wrong.
Anybody know something about this?