PDA

View Full Version : Fatal Error using ImageMagick



jmalone
11-26-2007, 04:10 PM
Hey there,

I contacted tech support for Hostmonster and was told that ImageMagick is installed on my shared server and there's nothing special I need to do to use it, so there must be something wrong with my code.

I'm starting small because I haven't used ImageMagick before. Here's my code:

<?php // test_imagemagick.php
$resource = NewMagickWand();
MagickReadImage($resource, 'image.jpg');

MagickCropImage($resource, 200, 50, 0, 0);

header('Content-Type: image/jpeg');
MagickEchoImageBlob($resource);
?>

FYI - test_imagemagick.php and image.jpg were both uploaded under the same directory.

The error:

Fatal error: Call to undefined function newmagickwand()

Any ideas or suggestion? Do I need to include a library or direct my script to ImageMagick somehow?

Thanks for any help!

r2b2
11-26-2007, 04:21 PM
Never really used ImageMagick before but from a quick Google search it looks like MagickWand requires a seperate PHP extension to be installed...

sjlplat
11-26-2007, 05:42 PM
Never really used ImageMagick before but from a quick Google search it looks like MagickWand requires a seperate PHP extension to be installed...

Correct. MagickWand is an API for ImageMagick.

Read more about it at http://www.magickwand.org/

jmalone
11-27-2007, 02:21 PM
Thanks for your help.

I found out some info and thought I'd reply in hopes that it may be helpful for others that want to use ImageMagick. After talking to tech support, I discovered that although Hostmonster has ImageMagick installed, MagickWand is not. So, in order to interact with ImageMagick, you need SSH Access (which you can get by faxing in your driver's license and hosted domain - talk to support). After you have access, then you can use shell scripting to use the "convert" commands for ImageMagick. It's quite simple. There's no need to use MagickWand.

I chatted with support for a little while and found that the binary for convert is located on the server at /usr/bin/convert

For help with ImageMagick commands and PHP, here are some links:
http://www.imagemagick.org/Usage/
http://us3.php.net/shell_exec

Good luck!

r2b2
11-27-2007, 02:44 PM
Thanks for updating us - its always good when you hear the outcomes.