Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have searched many questions on internet that show how to increase the size of text in imagestring(). They suggest to use imagettftext() but actually this doesn't work for me. Is there any way that I can increase the text size in imagestring() itself. And if that is not possible help me solve the black screen error I am getting.

Here is the PHP code:
PHP
header('content-type:image/jpeg');
$image = imagecreatefromjpeg("sample.jpg");
$color = imagecolorallocate($image, 225, 0, 0);

imagestring($image, 40, 100, 1000, 'sample', $color);

imagejpeg($image);

imagedestroy($image);

Thanks in advance...

What I have tried:

I have tried following a lot of tutorials but nothing works for me. You might view this whole code here
web - How to increase size of the text in imagestring() php without using imagettftext() in PHP - Stack Overflow[^]
Posted
Updated 8-Jun-20 2:30am
v2
Comments
Richard Deeming 8-Jun-20 8:33am    
Your "view the whole code" link doesn't help - your StackOverflow version of this question doesn't provide any more information or code than this one.

Looking at the documentation[^], imagestring doesn't let you change the font size. So you're going to need to use imagettftext.

We have no idea what "doesn't work" means, so we can't tell you what the problem is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900