Page 1 of 1

Uncaught exception 'ImagickDrawException' setFillPatternURL

Posted: 2008-08-27T08:01:44-07:00
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?

Re: Uncaught exception 'ImagickDrawException' setFillPatternURL

Posted: 2008-08-28T01:14:08-07:00
by mkoppanen
Can not help much without code sample.

Re: Uncaught exception 'ImagickDrawException' setFillPatternURL

Posted: 2008-08-28T08:53:03-07:00
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

Re: Uncaught exception 'ImagickDrawException' setFillPatternURL

Posted: 2008-08-28T14:26:14-07:00
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?

Re: Uncaught exception 'ImagickDrawException' setFillPatternURL

Posted: 2008-08-28T16:07:56-07:00
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!