Uncaught exception 'ImagickDrawException' setFillPatternURL

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
riquard

Uncaught exception 'ImagickDrawException' setFillPatternURL

Post by riquard »

Hi,

I got an error on my local Xamp (PHP: 5.2.5) installation in windows when I try: $draw->setFillPatternURL('#ice');

output:
Fatal error: Uncaught exception 'ImagickDrawException' in E:\xampp\htdocs\feest\helloworld.php:30 Stack trace: #0 E:\xampp\htdocs\feest\helloworld.php(30): ImagickDraw->setfillpatternurl('#ice') #1 {main} thrown in E:\xampp\htdocs\feest\helloworld.php on line 30

Any ideas?
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Uncaught exception 'ImagickDrawException' setFillPatternURL

Post by mkoppanen »

Can not help much without code sample.
Mikko Koppanen
My blog: http://valokuva.org
riquard

Re: Uncaught exception 'ImagickDrawException' setFillPatternURL

Post by riquard »

Code: Select all

<?php
/* Create a new imagick object */
$im = new Imagick( 'peritomoreno.jpg' );
/* Create imagickdraw object */
$draw = new ImagickDraw();
/* Start a new pattern called "ice" */
$draw->pushPattern( 'ice'  , 0  , 0  , 50  , 50 );
/* Composite the image on the pattern */
$draw->composite( Imagick::COMPOSITE_OVER, 0, 0, 50, 50, $im );
/* Close the pattern */
$draw->popPattern();
/* Use the pattern called "ice" as the fill */
$draw->setFillPatternURL( '#ice' );
/* Set font size to 52 */
$draw->setFontSize( 52 );
/* Annotate some text */
$draw->annotation( 5, 50, "Hello World!" );
/* Create a new canvas and white image */
$canvas = new Imagick();
$canvas->newImage( 310, 70, "white" );
/* Add black border around the resulting image */
$canvas->borderImage( 'black', 1, 1 );
/* Draw the ImagickDraw on to the canvas */
$canvas->drawImage( $draw );
/* Set the format to PNG */
$canvas->setImageFormat( 'png' );
/* Output the image */
header( "Content-Type: image/png" );
echo $canvas;
?>
That's an example from your site http://valokuva.org/?p=102, I only changed the source jpg. I also tried other code and it seems that whenever I call setFillPaternURL I get the error. When I comment it out, the scripts work fine. But no ice... thanks
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Uncaught exception 'ImagickDrawException' setFillPatternURL

Post by mkoppanen »

Can you try putting:

Code: Select all

try {
$draw->setFillPatternURL( '#ice' );
} catch( Exception $e) {
echo $e->getMessage();
}
instead of just $draw->setFillPatternURL( '#ice' );

What is the message on the exception?
Mikko Koppanen
My blog: http://valokuva.org
riquard

Re: Uncaught exception 'ImagickDrawException' setFillPatternURL

Post by riquard »

There is no message... The script works like that...was not supposed to work? :)
Thanks either way, it's very much appreciated. I've got ice!
Post Reply