1
votes

Website: https://bimmr6696.000webhostapp.com/signs/Sign.php?Line1=&Line2=asd&Line3=&Line4=

PhpInfo: https://bimmr6696.000webhostapp.com/signs/test.php


Currently I have the following code:

$img = LoadPNG('sign.png');
//$font = imageloadfont('minecraft.ttf');

// Add the text
imagettftext($img, 20, 0, 5,5, $black, 5, "Test Text");
imagestring($img, 5, 5, 50, 'Test Text', $text_color);


// Create image instances
$dest = imagecreatetruecolor(80, 40);

// Copy
imagecopy($dest, $img, 0, 0, 20, 13, 80, 40);

// Set the content type header - in this case image/png
header('Content-type: image/png');

// Output the image
imagejpeg($img);
imagejpeg($dest);

imagedestroy($dest);
imagedestroy($img);

When I use imagestring I'm able to get the text to show, but the text is too small which causes me to need imagettftext, although nothing shows when I use this. I've just about run out of ideas to try and solve this and so any help would be very appreciated.


TLDR: I need to either find out why imagettftext doesn't work or find a way to change font size with imagestring


Deleted everything then retyped it all out and for some reason that seemed to fix it... Because this isn't an actual answer I'm not going to post it below...

Could you post code for what LoadPng does? - alistaircol
It has actually been solved, I just don't see a solved button. It was solved by removing everything to it's barest, removing the copy and removing the image jpeg for the dest - Bimmr
If you could post your working solution, you can mark it as answered. This will help others with similar problem to you. - alistaircol
The problem with that is that I'm really not sure what the problem was... The way that it got fixed was just by removing everything and starting over, and for some reason, it worked even though nothing was really changed. - Bimmr