得到错误,图像注释+添加文本到图像,谁能帮助我


getting error , imagick annotate+ adding text to the image,can nybdy help me?

<?php
    $text=$_POST['text1'];
    $im1=$_POST['image'];
    echo $text;
    echo $im1;
    $im2 = new Imagick($im1);
    $im->annotateImage($im2, 0, 0, 0, $text);
    $im->setImageFormat('jpg');
    $thumbnail = $im->getImageBlob();
    header("Content-Type: $thumbnail");
    echo $thumbnail;
    echo '<img src="data:image/jpg;base64,'.base64_encode($thumbnail).'" />'; 
?>

工作代码:

<?php
/* Create some objects */
$image = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel( 'gray' );
/* New image */
$image->newImage(800, 75, $pixel);
/* Black text */
$draw->setFillColor('black');
/* Font properties */
$draw->setFont('Bookman-DemiItalic');
$draw->setFontSize( 30 );
/* Create text */
$image->annotateImage($draw, 10, 45, 0, 'The quick brown fox jumps over the lazy dog');
/* Give image a format */
$image->setImageFormat('png');
/* Output the image with headers */
header('Content-type: image/png');
echo $image;
?>

进一步参考:http://php.net/manual/en/imagick.annotateimage.php