问题描述
我想在图片中打印从facebook / instagram导入的字幕并保存。我想使用带有php的imagick库来做这个,因为我正在使用imagick创建基本图像。正常文本打印正确,但导入的表情符号不会打印为表情符号。 有人可以建议如何使用imagick打印表情符号。
我尝试过:
$ eachpageimg = new Imagick();
$ eachpageimg-> setResolution(300,300);
$ eachpageimg - > newImage(1050,1260,'rgb(255,255,255)');
$ eachpageimg-> setImageUnits(imagick :: RESOLUTION_PIXELSPERINCH);
$ eachpageimg-> ; setImageFormat('jpeg');
$ eachpageimg-> setImageCompressionQuality(100);
$ draw = new ImagickDraw();
$ pixel = new ImagickPixel('rgb(255,255,255)');
$ pixel-> setColorValue(Imagick :: COLOR_ALPHA,.8);
$ draw-> setStrokeColor('rgb(0,0,0)');
$ draw-> setFillColor('rgb(0,0,0) )');
$ draw-> setFont(ROBOTO-REGULAR);
$ draw-> setFontSize(70);
$ xpos = 10;
$ ypos = 200;
$ eachpageimg-> annotateImage($ draw,$ xpos,$ ypos,0,GshdhðŸ〜šðŸ〜ŽðŸ〜'ðŸ〜ðð¤ );
$ filename ='saved.jpg';
//保存最终页面图像
file_put_contents($ filename,$ eachpageimg);
I want to print the captions imported from facebook/instagram in an image and save it. I want to do this using imagick library with php as I am creating the base image using imagick. The normal text prints properly but the emojis that are imported do not get printed as emoji's. Can anyone suggest how emojis can be printed using imagick.
What I have tried:
$eachpageimg = new Imagick ();
$eachpageimg->setResolution ( 300 , 300 );
$eachpageimg->newImage (1050, 1260 , 'rgb(255,255,255)');
$eachpageimg->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH);
$eachpageimg->setImageFormat ('jpeg');
$eachpageimg->setImageCompressionQuality(100);
$draw = new ImagickDraw();
$pixel = new ImagickPixel( 'rgb(255, 255, 255)' );
$pixel->setColorValue(Imagick::COLOR_ALPHA, .8);
$draw->setStrokeColor('rgb(0,0,0)');
$draw->setFillColor ('rgb(0,0,0)');
$draw->setFont ("ROBOTO-REGULAR");
$draw->setFontSize (70);
$xpos = 10;
$ypos = 200;
$eachpageimg->annotateImage($draw, $xpos, $ypos, 0, "Gshdh😚😎😑😚🤠");
$filename = 'saved.jpg';
// SAVE FINAL page image
file_put_contents ($filename, $eachpageimg);
推荐答案
这篇关于如何用PHP使用imagick打印表情符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!