0
I’m converting a string to image to be used in a bank account. In view of this need, I have as an example the following variable:
$string = 10499.10657 01500.110045 00002.710038 9 79320000000000
Obs.: these of the variable are in UTF-8 string
Code:
$font = 5;
$width = imagefontwidth($font) * strlen($string);
$height = imagefontheight($font);
$image = imagecreate($width, $height);
$bg = imagecolorallocate($image, 255, 255, 255);
$textcolor = imagecolorallocate($image, 65, 65, 65);
imagestring($image, 5, 0, 0, $string, $textcolor);
header("Content-type: image/png");
imagepng($image);
And returns me an image in the tab with the value:
In another file, I have an html template that I need to insert, but how do I perform this passage via variable in the tag <img src="<?php ?>">
to just show where I want, not running on this tab as is occurring?
I read in some topics in English that it is necessary to convert to Base64 according to my understanding, in fact it is necessary? Reference: link
It worked right, thank you.
– Thalles Rangel