Page 1 of 1

How to create khmer Unicode character watermark on images using PHP ImageMagick Pango?

Posted: 2017-04-03T07:13:03-07:00
by hengsopheak
Dear Imagemagick
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

This is the website url which you can testing


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)) {

            return view('FrontEnd.results.maskGame', ['bg'=>$imagick, 'img'=>'no', 'result'=>$result]);

        $imagick->colorizeImage('rgba(150,90,50)', 1, true);

        $img_proper = $imagick->getImageProperties();

        $img = base64_encode($imagick->getImagesBlob());


        return view('FrontEnd.results.maskGame', ['bg'=>$imagick, 'img'=>$img,'img_proper'=>$img_proper, 'result'=>$result]);