I am trying to add some text over an image , and I want to use a custom font for it, so I used imagettftext. but it's not display anything . What am I doing wrong? When I use imagestring it works fine. But that does not use any custom font. I have placed my "Jomhuria-Regular.ttf" file in the same folder. here is my code :
<?php header('Content-type: image/jpeg'); $imgPath = 'download.jpeg'; $image = imagecreatefromjpeg($imgPath); $color = imagecolorallocate($image , 0 , 255 , 0); imagettftext ($image, 20, 0, 750, 500, $color, "Jomhuria-Regular.ttf", "test"); imagejpeg($image); ?>
https://stackoverflow.com/questions/66084178/imagettftext-not-showing-the-image February 07, 2021 at 11:06AM
没有评论:
发表评论