So, I've got a simple script set up for a blog that allows the user to upload images with their post. The script uses PBM to resize the images as needed. This was working perfectly previously, but now I can't get it to work.
Here's the code it's using:
system("djpeg $imagepath | pnmscale -xysize 125 105 | cjpeg -smoo 10 -qual 50 > $imagedir$imagestart.thumb.jpg", $test);
Where:
$imagepath = /full/path/to/100_0444.jpg
$imagedir = /full/path/to/
$imagestart = 100_0444 (generated by basename(); )
Now, if I run this command on the command line (substituting the vars for the actual file names, of course) it works beautifully. If I run this command via PHP from the command line (ie- "php test.php"), it works beautifully. If I run that same "test.php" from a browser, it fails miserably - the $test variable returns "127" for the result code, which, I'm assuming, means "screw you".
If I run the script via php on the command line (ie "php test.php"), the resulting 100_0444.thumb.jpg is owned by root. My webserver runs as "www". I chmoded the image directory, the source image, and all the binaries (djpeg, pnmscale, cjpeg) to 777.
I'm out of ideas. Anyone have any suggestions? I'm assuming djpeg is erroring out, so alternatively if someone could tell me how to get the resulting error out of the system() call, that would help too (if I assign it to a variable, it'll give me the last line of the result, but that's coming up blank).