I'm having trouble resizing an image via imagemagick's convert function. It's quite simple - I just want to shrink an existing image to a smaller dimension.
# Set input/output path/names
$original = "/Users/username/images/original.jpg";
$thumbnail = "/Users/username/images/thumbnail.jpg";
# Defines command to pass to system
$command = "convert -geometry 150x150 $original $thumbnail";
# Pass command to system and return code to $result
passthru($command, $result);
My setup:
PHP Version 4.2.3
ImageMagick 5.5.3
OSX 10.2
The directory (/Users/username/images/) is set as:
drwxrwxrwx - www - staff
The original file to be resized is set as:
-rwxrwxrwx - www - staff
As the system would be running as www when passed the commands from PHP, I don't think the permissions are wrong; additionally, they're both 777. I've tried changing the group to nobody, www, and still no dice.
If I echo $command and paste it into the shell, everything works perfectly. But from PHP, it doesn't do anything. If I echo $result, it displays '127.' I have confirmed that passthru(), exec(), system(), and shell_exec() all work with generic commands like 'ls' or even 'man ls', but they don't work for me with 'convert.' Using exec() returned an empty array as a result, vs '127,' but didn't do anything further.
Any help would be appreciated. I've searched this forum and the ImageMagick mailing list, and have seen similar problems, but no one has provided a solution. Could the www user possibly not have permission to call the ImageMagick convert command? That's probably more of an ImageMagick or BSD forum question, but if anyone knows, I'd appreciate the lesson.
Thanks!