Page 1 of 1

magickreadimage not working

Posted: 2009-02-03T23:12:26-07:00
by ncm123
Hello,

I have installed imagemagick and magickwand on my server. Phpinfo() shows that magickwand is installed -
The magickwand details are

MagickWand Extension Version 1.0.7
ImageMagick support enabled
ImageMagick version ImageMagick 6.4.8-10 2009-02-03 Q16 http://www.imagemagick.org

I am running a simple script that just reads the image from a folder and displays it back on the browser. But, when I run the script in the browser, only the url is printed on the page. On another script that I ran with some error handling. I got this error.

Warning: magickreadimage() [function.magickreadimage]: SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access / owned by uid 0 in /var/www/vhosts/server/httpdocs/folder/pencil1.php on line 19

Fatal error: magickreadimage(): PHP cannot read /folder/pencil/1440.gif; possible php.ini restrictions in /var/www/vhosts/server/httpdocs/folder/pencil1.php on line 19


What is going wrong here. I have run the script successfully on my home computer(windows +apache).

Thanks,

Nishant

Re: magickreadimage not working

Posted: 2009-02-17T15:43:51-07:00
by mkoppanen
Hello,

this is a restriction on the hosting environment and does not imply a bug in MagickWand for PHP. More information about PHP safe mode:
http://www.php.net/features.safe-mode

Re: magickreadimage not working

Posted: 2009-04-08T03:36:06-07:00
by ncm123
I removed the safe mode restriction in php. Now this script is displaying nothing on the page, no errors nothing.

This is the script
<?php
$r = NewMagickWand();
MagickReadImage($r,"2.jpg");
MagickOilPaintImage( $r, 3 );
header('Content-Type: image/jpeg');
MagickEchoImageBlob($r);
?>
____________________________________________________________________________________

Also I tried running this script
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);

$resource = NewMagickWand();
$dwand = NewDrawingWand();
$pwand = NewPixelWand();

PixelSetColor($pwand, "red");
DrawSetFont($dwand, "cour.ttf");
DrawSetFontSize($dwand, 50);
DrawSetFillColor($dwand, $pwand);
if(MagickReadImage($resource, "2.jpg")) {
}else
{
echo MagickGetExceptionString($resource);
}
if( MagickAnnotateImage( $resource, $dwand, 50, 50, 0, "Flower" ) )
{
header( 'Content-Type: image/gif' );
MagickEchoImageBlob( $resource );
}
else
{
echo MagickGetExceptionString($resource);
}
?>

This script gives this error- no decode delegate for this image format `/var/www/vhosts/example.com/httpdocs/pencil/2.jpg' @ constitute.c/ReadImage/526Wand contains no images `MagickWand-2' @ magick-image.c/MagickAnnotateImage/635

Does anyone have any clue whats happening.

Re: magickreadimage not working

Posted: 2009-04-08T05:39:15-07:00
by magick
Does your ImageMagick installation support JPEG? Type
  • convert -list format
and make sure the JPEG tag has a mode of rw-. If not you need to rebuild / reinstall ImageMagick with JPEG support.

Re: magickreadimage not working

Posted: 2009-04-10T03:41:12-07:00
by ncm123
How to install imagemagick with jpeg support?

Re: magickreadimage not working

Posted: 2009-04-10T06:21:56-07:00
by magick
See the Delegate Libraries subsection of this page: http://magick.imagemagick.org/script/ad ... p#problems.

Re: magickreadimage not working

Posted: 2009-04-21T22:09:27-07:00
by ncm123
Thank you this worked...