pinacoladaxb Posted July 19, 2008 Share Posted July 19, 2008 I want to generate an image based on user inputted data. The best way to describe what I want to do is to use an example... Let's say I want to make a 120 X 120 pixel image that represents user inputted data. I'd have it broken into 4 sections. Each section will hold an image that is a part of the entire image. So what I want to do is make user input determine what goes in each square. I want different numbers to mean different pictures. For example... 1 = smile 2 = frown If the user inputs the text "1221" then I want this image to be generated: Can anyone explain how to do this? I've seen similar things done before, so I know it's possible. Remember, I want the final image to be 1 image. Thanks in advance. EDIT: The way the text is inputted will be via POST. The POST string will be "input=(input)." The php page will just need to generate the image. Link to comment https://forums.phpfreaks.com/topic/115625-solved-generate-an-image-in-php/ Share on other sites More sharing options...
Barand Posted July 19, 2008 Share Posted July 19, 2008 In the main page <img src='myimage.php?text=1221'> in "myimage.php" <?php $text = $_GET['text']; //$text now contains 1221 $im = imagecreate(120,120); // build the image here header("content-type: image/png"); imagepng($im); imagedestroy($im); ?> Link to comment https://forums.phpfreaks.com/topic/115625-solved-generate-an-image-in-php/#findComment-594406 Share on other sites More sharing options...
pinacoladaxb Posted July 19, 2008 Author Share Posted July 19, 2008 I understood up to the part where I build the image. How do I build it? Link to comment https://forums.phpfreaks.com/topic/115625-solved-generate-an-image-in-php/#findComment-594408 Share on other sites More sharing options...
Barand Posted July 19, 2008 Share Posted July 19, 2008 Use imagecopy() to place the required smiley into each quadrant Link to comment https://forums.phpfreaks.com/topic/115625-solved-generate-an-image-in-php/#findComment-594413 Share on other sites More sharing options...
pinacoladaxb Posted July 19, 2008 Author Share Posted July 19, 2008 Thanks. I'll try it, but I may need more help as what I am actually doing is a lot more than this. Link to comment https://forums.phpfreaks.com/topic/115625-solved-generate-an-image-in-php/#findComment-594414 Share on other sites More sharing options...
pinacoladaxb Posted July 19, 2008 Author Share Posted July 19, 2008 I still can't figure out how to build the image. Could you explain it a bit more? Link to comment https://forums.phpfreaks.com/topic/115625-solved-generate-an-image-in-php/#findComment-594420 Share on other sites More sharing options...
pinacoladaxb Posted July 19, 2008 Author Share Posted July 19, 2008 Never mind. I figured it out. Thanks for the help! Link to comment https://forums.phpfreaks.com/topic/115625-solved-generate-an-image-in-php/#findComment-594425 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.