I am working on getting the autocolor, color2gray and toycamera scripts in place by using 'shell_exec' from PHP. I have been unable to get these scripts to work via 'shell_exec' due to an issue of being able to open the image. Everything is great when ran directly in the terminal on OSX 10.8 but throws the below error when being ran via PHP. I believe its an issue with the /tmp dir but wanted to get other thoughts.
../bin/filters/autocolor -m recolor \xe2\x80\x93c separate /private/tmp/IMAGE-TMP-KiVjSs /private/tmp/IMAGE-TMP-KiVjSs, referer: http://example.com/
convert: unable to open image `–c': No such file or directory @ error/blob.c/OpenBlob/2646.
convert: no decode delegate for this image format `–c' @ error/constitute.c/ReadImage/552.
convert: no images defined `/private/tmp/autocolor_1_25621.mpc' @ error/convert.c/ConvertImageCommand/3106.
Would anyone know why PHP may be unable to open the image in the /tmp dir? Thanks!
**UPDATE** - The image being written to the /tmp dir from apace / mod_php is _www. Is there something I need to set for 'convert' and the fred scripts that will fix the permission issues?
Last edited by corbanb on 2013-09-29T20:32:48-07:00, edited 2 times in total.
Perhaps PHP wants to use some other tmp directory and you do not have permission to use /tmp? You can point the script to some other tmp directory where you have permission and lots of space.
Is this your own server or a shared server? If the latter you may need to contact your ISP about using exec() and what permissions you need.
../bin/filters/autocolor -m recolor \xe2\x80\x93c separate /private/tmp/IMAGE-TMP-KiVjSs /private/tmp/IMAGE-TMP-KiVjSs, referer:http://example.com/
I do not understand the structure of your command. What do these red-highlighted items do? They are not arguments to my script and thus would confuse the script.
Thanks for the quick response Fred! I am not sure where that is coming from either. But I updated the script to get it right, followed the instructions in the PHP area on that page but still getting the errors below. Also this is running on my OSX 10.8 machine from a folder on the desktop for now. Any other thoughts?
# ERRORS
./autocolor -m recolor –c separate og.png og.png
convert: unable to open image `–c': No such file or directory @ error/blob.c/OpenBlob/2646.
convert: no decode delegate for this image format `–c' @ error/constitute.c/ReadImage/552.
convert: no images defined `/tmp/autocolor_1_27478.mpc' @ error/convert.c/ConvertImageCommand/3106.
➜ tests php auto.php
./autocolor -m recolor –c separate og.jpg og-new.jpg
convert: unable to open image `–c': No such file or directory @ error/blob.c/OpenBlob/2646.
convert: no decode delegate for this image format `–c' @ error/constitute.c/ReadImage/552.
convert: no images defined `./autocolor_1_5304.mpc' @ error/convert.c/ConvertImageCommand/3106.
I also retyped it all to be sure there were no hidden characters. Also my actual version of IM is 6.8.6-3 2013-07-06 Q16 if that helps.