Page 1 of 1

how do i catch error in imagick

Posted: 2008-10-08T23:34:04-07:00
by skyjan
hello

just wondering how do i return/catch the error in imagick

function imagehere()
{
$im = new Imagick();
/* Create empty canvas */
$im->newImage( 100, 100, "white", "jpg" );//png,jpg,gif.. image format
/* Create the object used to draw */
$draw = new ImagickDraw();
/* Set the button color.
Changing this value changes the color of the button */

$draw->setFillColor( new ImagickPixel("#FFFFFF") ); // BOX COLOR //#4096EE
/* Create the rectangle */
$draw->rectangle( 0,0, 100, 100 );


/* assuming there is still codes here
in any case there is an error
*/
$draw->setFont( "Fonts/arial.tt" ); // This generate error
$draw->setFontSize( 15 );

/* the question is how do i catch the error that the font is missing since i want to return an error value */




}

Re: how do i catch error in imagick

Posted: 2008-10-20T13:36:19-07:00
by mkoppanen
Use a try-catch block