Page 1 of 1

php & bash = unrecognized option `-brightness-contrast'

Posted: 2013-08-26T09:09:09-07:00
by pet
hello,

when i start a php exec a bash script with a 'convert IM script',
i get the error message:

" convert: unrecognized option `-brightness-contrast' @ convert.c/ConvertImageCommand/791."

but:
i can start directly the bash-shell test.sh without any errors
i can start a php script with directly exec. convert without errors
and !! a crop or other functions run without errors
only with 'brightness-contrast' in a background started shell-script get errors

My simple scripts:

##################################################################
start.php (with errors)

<?
exec("sudo -s nohup test.sh > /dev/null 2> /dev/null & echo $!") ;
echo "end convert ..."
?>

##################################################################

test.sh
#!/bin/sh

convert a.jpg -brightness-contrast 5x10 b.jpg ## with errors
convert a.jpg -crop 200x100+0+0 c.jpg ## without errors

exit

##################################################################

start.php (without errors)
<?
exec("sudo -s convert a.jpg -brightness-contrast 5x10 b.jpg ") ;
?>

##################################################################



My system:
centos 6 2.6.32-279.22.1.el6.x86_64
Version: ImageMagick 6.8.3-1 2013-02-21 Q16

Can anybody help me?

Re: php & bash = unrecognized option `-brightness-contrast'

Posted: 2013-08-26T09:14:15-07:00
by fmw42
Are you sure you do not have multiple version of IM installed and an older version is being used for which it predated -brightness-contrast?

Put the path to where IM resides into your command. Typically it will be /usr/bin or /usr/local/bin.

try

/usr/bin/convert -version

and

/usr/local/bin/convert -version

and see which is using the version you believe is what you have.

Re: php & bash = unrecognized option `-brightness-contrast'

Posted: 2013-08-26T10:27:37-07:00
by pet
was exactly the problem :D
a multiple version of IM
made a symlink to the wrong /bin path and now all work fine
thanks a lot