Jump to content

[SOLVED] Auto Upload After Generate?


jnerotrix

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/130109-solved-auto-upload-after-generate/
Share on other sites

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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.