jnerotrix Posted October 25, 2008 Share Posted October 25, 2008 Ok I Have Created An Id Generator and i want the generated image to automatically upload to specified folder after generated and then display the filename must be in a count Up 1st generated image = 1.png 2nd generated image = 2.png. here is the Files: Index.php <html> <head> <script language="javascript"> <!-- function showimage() { if (!document.images) return document.images.pictures.src= document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value } //--> </script> </head> <title> Example Form </title> <body> <center> <h1>Sandbox ID Card Generator</h1> <br><br> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100%"> <form name="mygallery" action="generatred.php" method="post"<p> User Name:<br> <input type="text" name="user"> <br> Text Line:(Max 25 Char.)<br> <input type="text" name="text"> <br><br> Color:<br> <select name="picture" size="1" onChange="showimage()"> <option selected value="./default.png">-- Default --</option> <option value="./babyblue.png">Baby Blue</option> <option value="./blue.png">Blue</option> <option value="./darkblue.png">Dark Blue</option> <option value="./darkpink.png">Dark Pink</option> <option value="./green.png">Green</option> <option value="./hotpink.png">Hot Pink</option> <option value="./orange.png">Orange</option> <option value="./purple.png">Purple</option> <option value="./red.png">Red</option> <option value="./teal.png">Teal</option> <option value="./yellow.png">Yellow</option> </select> </td> </tr> <tr> <td width="100%"><p align="center"><img src="default.png" name="pictures"></td> </tr> </table><br> <input type="submit" value="Generate"> </form> Generated.php: <?php $user = $_POST['user']; $img = $_POST['picture']; $string = $user; $im = imagecreatefrompng($img); $textColor = imagecolorallocate ($im, 0, 0, 0); imagestring($im, 80, 60, 85, "$string", $textColor); header ("Content-type: image/png"); imagepng($im); ?> I Want it so when it generates it uploads the file Quote Link to comment Share on other sites More sharing options...
Barand Posted October 25, 2008 Share Posted October 25, 2008 It's dynamically generated so there is no physical file to upload. Just create the file on the server in the first place. ... image creation code ... header ("Content-type: image/png"); imagepng($im, 'path/to/file.png'); imagedestroy($im); Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 How do i make the upload name 1st uploaded = "1.png" 2nd uploaded = "2.png" ect like that Quote Link to comment Share on other sites More sharing options...
Barand Posted October 25, 2008 Share Posted October 25, 2008 you would have to see what files were there already and give it the next name in sequence. Or store the count in a database or flat file Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 there is no files in the directory and i would like to store the count via flatfile but how is this done im sorry i am a php novice Quote Link to comment Share on other sites More sharing options...
Barand Posted October 25, 2008 Share Posted October 25, 2008 http://uk3.php.net/manual/en/ref.filesystem.php Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted October 26, 2008 Author Share Posted October 26, 2008 I fixed it all myself once again... http://mytestsite.rack111.com/idcard/generatred.php?id=1 http://mytestsite.rack111.com/idcard/generatred.php?id=2 http://mytestsite.rack111.com/idcard/generatred.php?id=3 http://mytestsite.rack111.com/idcard/generatred.php?id=4 http://mytestsite.rack111.com/idcard/generatred.php?id=5 ect... ect.. The Generate is being fixed but thats ok for now 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.