0

How can I arrange a dynamic image?

its working fine but i need to put jd logo on upper left corner

and when i do that black color appears

code that i am using currently

 createimageinstantly();
        function createimageinstantly($img1='',$img2='',$img3=''){
            $x=$y=1200;
            header('Content-Type: image/png');
            $targetFolder = 'D:/xampp/htdocs/festival/';
            $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;

            $img1 = 'demo.jpg';
            $img2 = 'img2.png';
            $img3 = 'img3.png';

            $outputImage = imagecreatetruecolor(1200, 1200);

            // set background to white
            $white = imagecolorallocate($outputImage, 0, 0, 0);
            imagefill($outputImage, 0, 0, $white);

            $first = imagecreatefromjpeg($img1);
            $second = imagecreatefrompng($img2);
            $third = imagecreatefrompng($img3);

            imagecopyresized($outputImage,$first,0,0,0,0, $x, $y,$x,$y);
            imagecopyresized($outputImage,$second,20,20,0,0, 1200, 1200, 1200,1200);
            imagecopyresized($outputImage,$third,1140,1140,0,0, 130, 100, 204, 148);

            // Add the text
            $text = 'School Name Here';
            $font = 'Calibribold.ttf';
            imagettftext($outputImage, 32, 0, 150, 150, $white, $font, $text);

            /*$filename =$targetPath .round(microtime(true)).'.png';
            imagepng($outputImage, $filename);*/
            imagejpeg($outputImage);
            imagedestroy($outputImage);
        }
  • 1
    Does this answer your question? [How to merge multiple images and text into single image?](https://stackoverflow.com/questions/35034428/how-to-merge-multiple-images-and-text-into-single-image) – HP371 Jan 21 '20 at 05:25
  • yes its work but when i put logo on upper left corner its showing black spot please check img 2 – Shabbir Lokant Jan 21 '20 at 05:43

0 Answers0