RE: [PHP] Block direct image loads but allow them in PHP
| From: | Rich Gray | Date: | Wed, 19 Feb 2003 10:03:33 +0000 |
| Subject: | RE: [PHP] Block direct image loads but allow them in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136134@lists.php.net to get a copy of this message | ||
[snip]
>
> if(isset($i))
> {
> //codeImageURL decodes $i into an image path that we can work with
> $link=codeImageURL($i);
> if($link!="" && (isAdmin() || !isThisFileBlocked($link)))
> {
> header("Cache-control: private");
> header("Content-type: image/jpg");
> header("Content-Disposition: attachment; filename=".$link);
> $fp = fopen($link, 'r');
> fpassthru($fp);
> fclose($fp);
> }
> else
> echo "Error: Couldn't decode image URL<br>\n";
> }
Michael
Have you tried header('Content-type: image/jpeg') ?
Note the 'e'...
Rich