Vini Posted May 5, 2006 Share Posted May 5, 2006 I've currently got a dynamic image setup, but i want it to read & output lines from a text file. instead of accept the form input.Im no coder so not sure where to begin, anyone shed any light?Below is the code for my [a href=\"http://www.vini.co.uk/dyn/\" target=\"_blank\"]DynaPic[/a][code]<?phpheader("Content-type: image/png");$string = $_POST['quote'];$im = imagecreatefrompng("idudesays.png");$colour = imagecolorallocate($im, 100, 100, 100);imagestring($im, 3, 90, 23, $string, $colour);imagepng($im);imagedestroy($im);?> [/code] Quote Link to comment Share on other sites More sharing options...
ober Posted May 5, 2006 Share Posted May 5, 2006 I'm not completely sure I understand the question or how it relates to your dynamic image script, but you should look into fopen(), fread(), fwrite() for reading and writing text files. Quote Link to comment Share on other sites More sharing options...
Vini Posted May 5, 2006 Author Share Posted May 5, 2006 [!--quoteo(post=371533:date=May 5 2006, 09:09 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 5 2006, 09:09 AM) [snapback]371533[/snapback][/div][div class=\'quotemain\'][!--quotec--]I'm not completely sure I understand the question or how it relates to your dynamic image script, but you should look into fopen(), fread(), fwrite() for reading and writing text files.[/quote]I have done, and they dont mean anything to me :SIm after listing quotes line by line in a text file, which i will read randomly and display on the image. Quote Link to comment Share on other sites More sharing options...
ober Posted May 5, 2006 Share Posted May 5, 2006 Well I'm not going to write it for you. The examples provided in the manual don't get much more clear on how to use them. Quote Link to comment Share on other sites More sharing options...
Vini Posted May 5, 2006 Author Share Posted May 5, 2006 [code] <?phpheader("Content-type: image/png");//change this to the number of random quotes you want (for example if you had 15 quotes it would be $number = rand(1,15);$number = rand(1,9);//change your random quotes hereif($number==1)$string2 = "all your base r belong 2 us";if($number==2)$string2 = "somebody set up us the bomb";if($number==3)$string2 = "Resistance is futile";if($number==4)$string2 = "R0D3NTS are cute";if($number==5)$string2 = "H4X0R in thE yur PC1?!";if($number==6)$string2 = "Dude w3re's my c4r?";if($number==7)$string2 = "s0m3on3 st0l3 my mega hurtz!!";if($number==8)$string2 = "move zig for great justice";if($number==9)$string2 = "Rodents make the world cool";//put your image name here (must be a png)$im = imagecreatefrompng("idudesays.png");//change your text color here ( must be the hex value) ex. 255,255,255 would be white$color = imagecolorallocate($im, 100, 100, 100);//change your X & y coordinates here to place the text on your image where you want it//(these will center the text on a 400x100 image)$px=90;$py=12;//no need to touch this unless you know what your doingimagestring($im, 3, $px, $py, $string, $color);imagestring($im, 3, $px, $py+12, $string2, $color);imagepng($im);imagedestroy($im);?>[/code]is something i found which reads from the file, but Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.