Ive seen this done before, even had a script at one time but lost it, so ill ask it here (i did search and found nothing). I want to generate images with custom text on them. So for example image.php?size=2&text=sweet or whatever.
For people who know a lot about php that probably isnt that hard. But i also (if possible) want it to look something like the header on my blog (http://www.open-server.org). I dont know if that is possible or not but i would like anyones help who can offer ideas. I have the font downloaded for the banner on my site, and i would like to be able to automaticly generate the text on it on the fly for the blog hosting service i run that way people can have custom banner images.
Thanks in advance.
Generate images on the fly
Moderator: General Moderators
this sounds like the sort of thing your after http://www.alistapart.com/articles/dynatext/
Code: Select all
<?php
$size = (isset($_GET['size']) ? intval($_GET['size']) : ''); /* change '' to default size */
$text = (isset($_GET['text']) ? strval($_GET['text']) : ''); /* change '' to default text */
$image = imagecreate(300, 300); /* create image 300pix by 300pix */
$background = imagecolorallocate($image, 255, 255, 255); /* white background */
$textcolour = imagecolorallocate($image, 0, 0, 0); /* black text */
imagestring($image, $size, 0, 0, $text, $textcolour);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>