Problem running MagicWand with PHP in Linux!

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
ElGuiz

Problem running MagicWand with PHP in Linux!

Post by ElGuiz »

Hi There!

im having problems running the MagicWandforPHP, and im unable to find the error...

the extension is apparently, installed correctly.
i have tried both as extension or compiled with the php.
and have tried the 0.1.8 and the 1.0.4

and it dont show any error, just dont do anything.. thats the reason i cant find the problem.
if i try to write with some text, and the font cant be find, it shows the error, but when you fix that, nothing else is showed.

this is the information of my instalations:

PHP Version 5.2.3, running with FastCGI on a Zeus web server
Linux Red Hat Enterprise Linux ES release 4 (Nahant Update 4)

and information in phpinfo()

MagickWand Extension Version 1.0.4
ImageMagick support enabled
ImageMagick version ImageMagick 6.3.5 07/16/07 Q16 http://www.imagemagick.org

and this are the scripts executed

Code: Select all

<?
                $magick_wand=NewMagickWand();
                MagickNewImage($magick_wand, 100, 100, "red");
                MagickSetImageFormat($magick_wand, "jpeg");
                MagickEchoImageBlob($magick_wand);
?>
if i run this Imagemagic example from the SSH, it works well, but dont do anything from the web.

Code: Select all

<?php system("convert -background lightblue -fill blue -font verdana.TTF -pointsize 72 label:Anthony label.gif");
?>
and this other example:

Code: Select all

<?php
//  header("Content-Type: text/plain");
  system("exec 2>&1; type convert");
// Output: convert is /usr/local/bin/convert
  system("exec 2>&1; convert -version");
// Output: Version: ImageMagick 6.2.8 06/10/06 Q16 http://www.imagemagick.org
// Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
  system("exec 2>&1; convert -list type");
// Only the first couple of lines of this output :
// Path: /usr/local/lib/ImageMagick-6.2.8/config/type-ghostscript.xml Name Family Style Stretch Weight ---------------------------------------$
// AvantGarde-Book AvantGarde Normal Normal 400 AvantGarde-BookOblique AvantGarde Oblique Normal 400 AvantGarde-Demi AvantGarde Normal Normal $
?>
return this from the SSH:

convert is /usr/local/bin/convert
Version: ImageMagick 6.3.5 07/16/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

and this from the Web:

sh: line 0: type: convert: not found sh: convert: command not found sh: convert: command not found



i hope someone had this problem before, and could help me a little with this.

thank you all!
Matthew.
ElGuiz

Re: Problem running MagicWand with PHP in Linux!

Post by ElGuiz »

i think resolved it.

the fail in my case was in ImageMagick-6.3.5-2.tar.gz
i think the version is not working properly with MagickWand

i tryed the php4, php5, and both Magickwands, all with errors.

now i have downloaded and installed ImageMagick-6.3.2-9.tar.gz
and works perfect with php4 and php5.

hope it helps more people with same problem.
and maybe fix the issue.

Matthew.
swapneel

Re: Problem running MagicWand with PHP in Linux!

Post by swapneel »

Faced exactly this same issue in our of our servers,

root@constitution# php -v
PHP 5.2.3 (cli) (built: Aug 6 2007 02:25:14)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.2.8, Copyright (c) 1998-2007, by Zend Technologies

PHP installed as CLI (module) and Imagemagick 6.3.5 wouldn't work. PHP code, snippet given below wouldn't output the expected results. Instead the script when called from the browser would show whitespace instead of the height and the width.

Code: Select all

<?php
$magick_wand = NewMagickWand();
if(!MagickReadImage($magick_wand,"flower_original.jpg"))
{
echo "error reading images.";
}
// header( 'Content-Type: image/jpeg' );
// MagickEchoImageBlob($magick_wand);
$width = MagickGetImageWidth( $magick_wand );
$height = MagickGetImageHeight( $magick_wand );
echo "Image size, in pixels, is:  width $width x height $height";

?>
Reverting to 6.3.3 too didn't work as the 'convert' binary installed in /usr/local/bin/' ( ImageMagick installation was specified '/usr/local/' using the --prefix configure option ) would still show 6.3.5 even though there were no errors during installation.

Finally installing 6.3.4 worked like a charm. Any reason why this would be happening ? In case if anyone needs any further information then please let me know.

Cheers !
Swapneel
andrabr

Re: Problem running MagicWand with PHP in Linux!

Post by andrabr »

swapneel wrote: Finally installing 6.3.4 worked like a charm. Any reason why this would be happening ? In case if anyone needs any further information then please let me know.
l
I tried 6.3.4, by 1.0.4 actually insists on 6.3.5 (it's in the very beginning of 'configure'). How did you get around it? [just editing configure does not seem like a safe thing to do : things are there for a reason]

Thx!
Post Reply