<?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).'" />';
?>
问问题
87 次
1 回答
0
工作代码:
<?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
于 2013-01-11T18:57:08.653 回答