magickreadimage not working

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
ncm123

magickreadimage not working

Post 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
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: magickreadimage not working

Post 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
Mikko Koppanen
My blog: http://valokuva.org
ncm123

Re: magickreadimage not working

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: magickreadimage not working

Post 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.
ncm123

Re: magickreadimage not working

Post by ncm123 »

How to install imagemagick with jpeg support?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: magickreadimage not working

Post by magick »

See the Delegate Libraries subsection of this page: http://magick.imagemagick.org/script/ad ... p#problems.
ncm123

Re: magickreadimage not working

Post by ncm123 »

Thank you this worked...
Post Reply