I have this code running in CentOS 5.5 ,PHP 5.1.6 ,Apache/2.2.3 ,ImageMagick 6.2.8
$convert = "/usr/bin/convert";
$command = "$convert -size 100x100 xc:blue mytest.jpg";
$test_image = exec($command);
echo "<img src=\"mytest.jpg\">";
when i run the php tester i dont get the image created , only the echo string printed on page as html.
but when i run the same command as onliner the image does created just fine.
/usr/bin/convert -size 100x100 xc:blue mytest.jpg
what is wrong here i can’t tell.
Your PHP assumes that the web server has permissions to execute programs and to write to the current directory. You should use
popen()to send the image to stdout and either use thedata:scheme to embed the image data into the HTML, or put the PHP script as thesrcfor theimgtag and output the appropriate header and then the image data.