View Full Version : Header Question

05-08-2009, 08:09 PM
I have a image resize script that has a content header, when I try to put a submit form on the same page the form codes show up as html, I tried inclosing the form in a php tag and that didn't help either. Do I have to put the submit form on a separate page? Thanks Joe

header('Content-type: image/gif');

05-08-2009, 08:31 PM
No the form can be in the same script. Can you please post your coding?

05-08-2009, 08:38 PM
$filename = $_POST["url"];
$percent = $_POST["per"];
$XXX = $_POST["xxx"];

header('Content-type: image/gif');

// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;

// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromgif($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, null, $XXX);

<form action='A1.php' method='post'>
Image URL: <input type='text' name='url' size='45' value='' />
Image Quality: <input type='text' name='xxx' size='4' value='100' />
Reset: <input type='reset' value='Reset'><br /><br />
<select name='per'>
<option>Select Size</option>
<option value='0.25'>1/4</option>
<option value='0.5'>1/2</option>
<option value='0.75'>3/4</option>
<option value='1' selected>Full</option>
<option value='1.25'>1-1/4</option>
<option value='1.5'>1.5</option>
<option value='1.75'>1-3/4</option>
<option value='2'>2</option>
<input type='submit' onclick='return validate(this.form)' value='Submit'>