this has been bugging me. i have a script that lets people cut out a section of an image for use in a thumbnail. all that works fine and the image generation works fine, but in IE if you go to that thumbnail URL (for example something like thumbnail.php?s=100,100,8,image.jpg) it displays the image, but it also brings up a Download prompt to Download the php file. of course if you do its just jargon, but its really annoying.
here is the script, does it have to do with the headers? it doesnt bring up the prompt in mozilla...
$dir = "../../gallery/";
$specs = (isset($_GET['s']))?$_GET['s']:NULL;
if ($specs) {
$specs = explode(",", $specs);
$loc = $dir . $specs[2] ."/". $specs[3];
if (is_file($loc)) {
$image_type = getimagesize($loc);
$image_type = $image_type[2];
switch ($image_type) {
case 1: $src_img = imagecreatefromgif ($loc); break;
case 2: $src_img = imagecreatefromjpeg($loc); break;
case 3: $src_img = imagecreatefrompng ($loc); break;
}
if ($src_img) {
header("Content-Type: image/jpg");
$new_img = imagecreatetruecolor(50,75);
imagecopy($new_img, $src_img, 0, 0, $specs[0], $specs[1], 50, 75);
imagejpeg($new_img);
imagedestroy($new_img);
imagedestroy($src_img);
}
}
}d'oh, nevermind, i fixed it. i just had to change image/jpg to image/jpegyeah I was going to mention that before I read your second post. good job.
here is the script, does it have to do with the headers? it doesnt bring up the prompt in mozilla...
$dir = "../../gallery/";
$specs = (isset($_GET['s']))?$_GET['s']:NULL;
if ($specs) {
$specs = explode(",", $specs);
$loc = $dir . $specs[2] ."/". $specs[3];
if (is_file($loc)) {
$image_type = getimagesize($loc);
$image_type = $image_type[2];
switch ($image_type) {
case 1: $src_img = imagecreatefromgif ($loc); break;
case 2: $src_img = imagecreatefromjpeg($loc); break;
case 3: $src_img = imagecreatefrompng ($loc); break;
}
if ($src_img) {
header("Content-Type: image/jpg");
$new_img = imagecreatetruecolor(50,75);
imagecopy($new_img, $src_img, 0, 0, $specs[0], $specs[1], 50, 75);
imagejpeg($new_img);
imagedestroy($new_img);
imagedestroy($src_img);
}
}
}d'oh, nevermind, i fixed it. i just had to change image/jpg to image/jpegyeah I was going to mention that before I read your second post. good job.