Tody, I come here to ask you again on creating Khmer character watermarks on images using php imageMagick2.0.1
as the previous question I can used ImageMagick via Pango to render Khmer characters on images but now I'm facing another problem some times it working but sometime it dose not work when I try to execute this code.
so you can see the video and my below code to find some problem inside it.
This is the line of video that I've tried to test https://youtu.be/4aMAHykeG3o
This is the website url which you can testing http://camvgo.com/game/cards/2
Thanks.
Code: Select all
function createImages (){
$text = " សូមអគុណដែលបានចូល ";
$strokeColor = "rgb(255, 0, 157)";
$fillColor = "red";
$backgroundColor = "#001";
$imagick = new \Imagick();
$result = [];
if($imagick->setFont(public_path('image/fonts/Kh-Muol_0.ttf')) == false) {
$result[] = 'setFont';
}
if($imagick->setPointSize(29) == false){
$result[] = 'setPointSize';
}if($imagick->setPage(10,10,10,10) == false){
$result[] = 'setPage';
}
$dd = $imagick->newPseudoImage(1000, 200, "pango:".$text."");
if($dd != true){
$result[] = 'newPseudoImage';
}
if(!empty($result)) {
$imagick->clear();
return view('FrontEnd.results.maskGame', ['bg'=>$imagick, 'img'=>'no', 'result'=>$result]);
}
$imagick->setBackgroundColor('transparent');
$imagick->setImageOpacity(1);
$imagick->colorizeImage('rgba(150,90,50)', 1, true);
$imagick->setImageFormat("gif");
$imagick->roundCornersImage(5,5,1,1,10);
$imagick->setImageBorderColor($fillColor);
$img_proper = $imagick->getImageProperties();
$img = base64_encode($imagick->getImagesBlob());
$imagick->writeImage(public_path('image/card/new/working.gif'));
$imagick->clear();
return view('FrontEnd.results.maskGame', ['bg'=>$imagick, 'img'=>$img,'img_proper'=>$img_proper, 'result'=>$result]);
}