imagick 加水印phpjava 乱码

xiaoxiao2026-08-22  11

php代码 $draw = new ImagickDraw(); $draw->setFont('C:\\WINDOWS\\Fonts\\simsun.ttc'); //必须标明字体 $draw->setFontSize( 12 ); $file = 'E:\\images\\11.gif'; $animation = new Imagick(); //create animation object $animation->setFormat('gif'); // set file type $image = new Imagick($file); $ftype = strtolower($image->getImageFormat()); $num = $image->getNumberImages(); $text = iconv('gb2312', 'utf-8', '*********);//只支持utf-8 //$text = '**********; //$draw->setTextEncoding("utf-8"); for($i=0;$i<$num;$i++) { $image->setImageIndex($i); $thisimage = new Imagick(); $thisimage->readImageBlob($image); $delay = $thisimage->getImageDelay(); $thisimage->annotateImage($draw, 0, 12, 0, $text); $animation->addImage($thisimage); $animation->setImageDelay( $delay ); } $image->destroy(); $image->clear(); header( "Content-Type: image/gif" ); echo( $animation->getImagesBlob() ); java 只需要指定字体即可。 相关资源:完美解决PHP中文乱码
转载请注明原文地址: https://www.6miu.com/read-5051667.html

最新回复(0)