I did delete those 2 lines, and it still did not do me any good,
first i deleted
PHP Code:
header("Content-disposition:$attachment filename=$attachmentinfo[filename]");
header("Content-Length: ".strlen($attachmentinfo[filedata]));
then i replaced,
PHP Code:
if ($extension=="gif") {
header("Content-type: image/gif");
} elseif ($extension=="jpg" or $extension=="jpeg") {
header("Content-type: image/pjpeg");
} elseif ($extension=="png") {
header("Content-type: image/png");
} elseif ($extension=="pdf") {
header("Content-type: application/pdf");
} else {
header("Content-type: unknown/unknown");
}
echo $attachmentinfo[filedata];
with
PHP Code:
$isimage = true;
switch ($extension)
{
case "gif":
$header = "image/gif";
break;
case "jpg":
case "jpeg":
$header = "image/jpeg";
break;
case "png":
$header = "image/png";
break;
case "pdf":
$header = "application/pdf";
$isimage = false;
break;
default:
$isimage = false;
$header = "unknown/unknown";
}
header("Content-disposition: inline; filename=" . $attachmentinfo['filename']);
header("Content-type: $header");
if ($isimage)
{
// watermark options:
$filename = "watermark.png"; // use a PNG-24 to preserve transparency!
$im = imagecreatefromstring($attachmentinfo['filedata']);
imagealphablending($im, true);
$watermark = imagecreatefrompng($filename);
$y = imagesy($im) - imagesy($watermark);
$w = imagesx($watermark);
$h = imagesy($watermark);
imagecopy($im, $watermark, 0, $y, 0, 0, $w, $h);
imagejpeg($im, "", 80);
}
else echo $attachmentinfo['filename'];
and i still get the red x's for images.