I'll quote the code below, but essentially this is the situation. I'm using netpbm to transform jpeg to pnm, scale the pnm, then transform back to jpeg. When I run the commands through PHP using exec() (or system()) the correct files are created, but they are 0k files and so unusable. (www has permission to write to the directory.)
However, when I echo the exact commands into the browser, then copy those and paste them into the command line, it works perfectly.
Here's the code. Both of the filenames are absolute references.
Code: Select all
<?php
$command = 'jpegtopnm ' . $image . ' > ' . IMAGE_DIR . $name . '.ppm';
exec($command);
$command = 'pnmscale -width=' . $max_width . ' ' . IMAGE_DIR . $name . '.ppm' . ' > ' . IMAGE_DIR . '1_' . $name . '.ppm';
exec($command);
$command = 'pnmtojpeg ' . IMAGE_DIR . '1_' . $name . '.ppm' . ' > ' . IMAGE_DIR . $name;
exec($command);
?>Apache/1.3.26, PHP 4.1.2, OS X 10.2.3, Netpbm 9.25
-tinfoilgrrl