currently i have two files
1) workingscript.html --> html form
2) redirection.php --> page where the created (png) file is displayed on the browser...
problem (@ redirection.php): when i try to save the created image (png) file in my hard disk (right click > save picture as) ....i cannot to preview/open the png file that i just earlier saved in my hard disk
[B]See figure_1.jpg [/B]
output png image at redirection.php
[url]http://www.geocities.com/yekis/figure_1.jpg[/url]
[B] See figure_2.jpg [/B]
Saving the image as outputPNGImage.png in my hard disk
[url]http://www.geocities.com/yekis/figure_2.jpg[/url]
[B] See figure_3.jpg [/B]
There was an error displaying outputPNGImage.png that was just earlier saved in my hard disk
[url]http://www.geocities.com/yekis/figure_3.jpg[/url]
anyway, here's my code
1) workingscript.html
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
</script>
<meta name="author" content="Rexcel Cariaga">
<link href="xampp.css" rel="stylesheet" type="text/css">
<title>Buy and Sell @ Cube iTV</title>
</head>
<body>
<img src="background.png">
<form name="ff" action="redirection.php" method="post">
<table width="400" border="0">
<tr>
<td width="200"></td>
<td width="200"></td>
</tr>
<tr>
<td>First Name of Seller</td>
<td><input name="text" type="text" size="25" maxlength="14"></td>
</tr>
<tr>
<td><p>Contact Number</p>
</td>
<td><label>
<input name="contact" type="text" id="contact" value="091XXXXXXXX" size="25" maxlength="12">
</label></td>
</tr>
<tr>
<td>Product Name</td>
<td><label>
<input name="product" type="text" id="product" size="25" maxlength="25">
</label></td>
</tr>
<tr>
<td>Description</td>
<td><label>
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 100 characters. )<br>
<textarea name="description" id="description" wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.description,this.form.remLen,100);" onKeyUp="textCounter(this.form.description,this.form.remLen,100);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="100"> characters left</font>
<br>
</label></td>
</tr>
<tr>
<td>Price (PHP)</td>
<td><label>
<input name="price" type="text" id="price" size="25" maxlength="7">
</label></td>
</tr>
<tr>
<td> </td>
<td><center><input type="submit" name="submit" value="Submit">
</center></td>
</tr>
</table>
</form>
<p>
</body>
</html>
2) redirection.php
<?php
### when the user presses the submti button then use gd functions...
if (isset($_POST['submit']))
{
header("Content-type: image/png");
$name = $_POST['text']; # get value for name...
$contact = $_POST['contact']; # get value for contact...
$product = $_POST['product']; # get value for product...
$price = $_POST['price']; # get value for price...
$description = $_POST['description']; # get value for price...
$im = imagecreatefrompng("background.png");
$white = imagecolorallocate($im, 255, 255, 255);
#loads font
$font = "ariblk.ttf";
# this is for product
// imagestring($im, 5, 190, 20, $product, $white);
imagettftext($im, 18, 0, 10, 40, $white, $font, $product);
# this is for description...
$text = $description;
$new_text = wordwrap($text, 15, "\n", true);
imagettftext($im, 18, 0, 10, 90, $white, $font, $new_text);
# this is for name
//imagestring($im, 5, 300, 300, $name, $white);
imagettftext($im, 14, 0, 300, 315, $white, $font, $name);
# this is for contact number
//imagestring($im, 5, 300, 320, $contact, $white);
imagettftext($im, 14, 0, 300, 340, $white, $font, $contact);
# this is for price
//imagestring($im, 5, 370, 80, $price, $white);
imagettftext($im, 17, 0, 363, 88, $white, $font, $price);
imagepng($im);
imagedestroy($im);
}
?>
<html>
<head>
<meta name="Rexcel Cariaga" content="Interactive PNG Creation" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
i have also attached background.png that i'm currently using in my script..tnx!!
http://www.geocities.com/yekis/background.png