Answer the question
In order to leave comments, you need to log in
How to save an image to a variable?
I use the following function to put text on an image:
function make_image($text,$font,$size) {
$img = imagecreatefromjpeg('ui-bg-tile_1000_2.jpg');
$color = imagecolorallocate ($img, 255, 255, 255);
imagettftext($img, $size, 0, 10, 200, $color, $font, $text);
imagejpeg($img);
imagedestroy($img);
}
imagejpeg($img,'img.jpg'); $return = file_get_contents('img.jpg');
Answer the question
In order to leave comments, you need to log in
ob_start();
imagejpeg($img);
$return = ob_get_contents();
ob_end_clean();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question