Re: Using ImageMagick
| From: | Blue Prawn | Date: | Wed, 03 Dec 2003 10:46:41 +0000 |
| Subject: | Re: Using ImageMagick | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-4270@lists.php.net to get a copy of this message | ||
> I have ImageMagick installed on my machiene and I have added the wrapper
> class for PHP as an extension. ImageMagick shows in phpinfo(), but when I
> try to load a image using "$handle =
> imagick_readimage(getcwd()."/image.jpg");" then $handle is completely
> blank. ie. No resource is returned to $handle. The image is in the same
> directory as the php file that I'm running. Any suggestions as to how I can
> get this to work??
I think if you have posted here, it means that you do want to use the imagick
handle to be load in a php-gtk widget.
So indeed before doing this you have to get a valid handle.
php-gtk is most often used throught php-cli so rather than
(getcwd().'/'.$file_name) you should use ($_ENV['PWD'].'/'.$file_name)
so
then when your script is ok, you can install it in /usr/local and the file
name took on the argv will have the good path. The other solution given in
the imagick package is better for a use on a web server.
Perhaps you should also make a
if(!file_exists($path2file)) die("File $path2file not found!\n");
if(!is_readable($path2file)) die("File $path2file not readable!\n");
Ok then to load it in php-gtk, here is a simple sample exemple to show howto:
http://grincheux.codelutin.org/~monnier/pim/g/sample/imagick2gtk-sample.html
Well another thing you could notice to use imagick through php-gtk (and
php-cli in general) is that to get the error on 2> rather than on 1>
rather than this classic exemple from imagick package:
http://grincheux.codelutin.org/~monnier/doc/imagick/charcoal.php
idem you could use:
function im_charcoal ( &$handle, $factor, $sigma ) {
if ( !imagick_charcoal($handle, $factor, $sigma) ) {
fwrite(STDERR,
sprintf("Charcoal failed!\nReason: %s\nDescription: %s\n",
imagick_failedreason ($handle),
imagick_faileddescription($handle) ) );
exit;
}
}
++