<?php $size = getimagesize($filename); $fp = fopen($filename, "rb"); if ($size && $fp) { header("Content-type: {$size['mime']}"); fpassthru($fp); exit; } else { // error } ?> PHP: I have replaced $filename with 'watermark.png' The result is http://crazyjunction.com/GD/1.php
getimagesize() use to get the information of an image, this is example: your code is ok but http://crazyjunction.com/GD/1.php code error because you echo somethings above the header() function line
you can use imagick. see the sample here: http://hk2.php.net/manual/en/function.imagick-getimagesize.php it really simple.