I have a little script that gets an image from a database, and prompts to download it to the local system. It was working fine until I added a little code to insert a watermark. The new code works fine too and is indeed inserting the watermake but, rather than prompting to download, the image now simply appears on the screen! I don't see anything wrong so maybe other pairs of eyes can help.
In the code below, $im is the image with the watermark inserted and the other variables are being declaired too, but this code seems to be where the problem is:
If I remark out ImageJPEG() for example, it then prompts to download but the resulting image is no good. Any ideas?
Don
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases
In the code below, $im is the image with the watermark inserted and the other variables are being declaired too, but this code seems to be where the problem is:
Code:
$jpegQuality = 72;
switch ($mime_type) {
case "gif":
ImageColorTransparent($im, $imagebgcolor);
ImageGIF($im);
break;
case "jpeg":
ImageJPEG($im, "", $jpegQuality);
break;
case "png":
ImageColorTransparent($im, $imagebgcolor);
ImagePNG($im);
break;
default:
ImageJPEG($im, "", $jpegQuality);
}
ImageDestroy($im);
Header ("Content-Disposition: attachment; filename=" . $ImageName . "." . $mime_type);
Header ("Content-type: image/" . $mime_type);
Header ("Pragma: no-cache");
echo $im;
If I remark out ImageJPEG() for example, it then prompts to download but the resulting image is no good. Any ideas?
Don
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases