Created
December 23, 2020 10:12
-
-
Save sabbir268/f2f0fbf08625194f81f1e5148801c8c5 to your computer and use it in GitHub Desktop.
Revisions
-
sabbir268 created this gist
Dec 23, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ <?php $text = "NAVID"; $image = imagecreatefrompng('image.png'); $textColor = imagecolorallocate($image, 255, 255, 254); $white = imagecolorallocate($image, 255, 255, 255); $col_transparent = imagecolorallocatealpha($image, 255, 255, 255, 127); imagefill($image, 0, 0, $col_transparent); imagecolortransparent($image, $col_transparent); //Full Font-File Path $fontPath = 'C:/xampp/htdocs/personal/imgae/verdana.ttf'; foreach (str_split($text) as $key => $value) { imagettftext($image, 50, $key*10, 1020+(50*$key), 662+(50*$key), $textColor, $fontPath, $value); } // imagettftext($image, 50, -4, 1200, 650, $textColor, $fontPath, "HELLO"); //Set Browser Content Type header('Content-type: image/png'); /** Download image */ // header('Content-Description: File Transfer'); // header('Content-Type: application/octet-stream'); // header('Content-Disposition: attachment; filename=image.png'); // header('Content-Transfer-Encoding: binary'); // header('Connection: Keep-Alive'); // header('Expires: 0'); // header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); // header('Pragma: public'); //Send Image To Browser imagepng($image); //Clear Image From Memory imagedestroy($image);