Riseykins Posted April 23, 2008 Share Posted April 23, 2008 OK, so I'm creating a glitter generator, and I'm a little stuck. I've got the BASIC idea: http://unphased.org/php_post As you can see, it is far from finished. This is something I did in five minutes. Here's an example of what happens presently: Type "hi" into the box, and get out http://www.unphased.org/php_post/hi.jpg out. What I want it to do is generate a new image for each letter: http://www.unphased.org/php_post/h.jpg http://www.unphased.org/php_post/i.jpg I've not added images yet, but there we go. If anyone could help, I'd appreciate it! Ta! Link to comment https://forums.phpfreaks.com/topic/102511-creating-a-glitter-generator/ Share on other sites More sharing options...
Riseykins Posted April 23, 2008 Author Share Posted April 23, 2008 Just a wee bump! Link to comment https://forums.phpfreaks.com/topic/102511-creating-a-glitter-generator/#findComment-525117 Share on other sites More sharing options...
Barand Posted April 23, 2008 Share Posted April 23, 2008 First, you need GD image script to create an image of the letter passed to it letter_img.php <?php $im = imagecreate(32,32); $c = $_GET['char']; $bgd = imagecolorallocate($im, rand(1,255),rand(1,255),rand(1,255)); $white = imagecolorallocate($im, 255,255,255); imagettftext($im, 20, 0, 5, 25, $white, 'c:/windows/fonts/arial.ttf', $c); header("content-type: image/png"); imagepng($im); imagedestroy($im); ?> Then you need a script to place an image on the page for each letter in the word. <?php if (isset($_GET['btn'])) { $word = $_GET['word']; $x = strlen($word); for ($i=0; $i<$x; $i++) { $c = $word[$i]; echo "<img src='letter_img.php?char=$c'>"; } } ?> <form> Word <input type="text" name="word" size="8" /> <input type="submit" name="btn" value="Submit" /> </form> Link to comment https://forums.phpfreaks.com/topic/102511-creating-a-glitter-generator/#findComment-525308 Share on other sites More sharing options...
Riseykins Posted April 23, 2008 Author Share Posted April 23, 2008 Thanks! I'll give it a try! Link to comment https://forums.phpfreaks.com/topic/102511-creating-a-glitter-generator/#findComment-525438 Share on other sites More sharing options...
Riseykins Posted April 23, 2008 Author Share Posted April 23, 2008 It's all working perfectly. Thanks a lot! Link to comment https://forums.phpfreaks.com/topic/102511-creating-a-glitter-generator/#findComment-525447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.