note 78641 rejected from function.imagejpeg by james
| From: | james@php.net | Date: | Sun, 21 Oct 2007 04:20:17 +0000 |
| Subject: | note 78641 rejected from function.imagejpeg by james | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-131590@lists.php.net to get a copy of this message | ||
Note Submitter: andrew
----
I'm trying to simply display an image without having to recreate it. This is to block
non-members from accessing fullsize images. The .htaccess file redirects
"photos/image.jpg" to "download.php?p=image.jpg". Then download.php checks if
they are logged in, and if they are, lets them see the fullsize image.
<?php
if( !$loggedin ) {
// do something
}
else {
header("Content-Type: image/jpeg");
$image = imagecreatefromjpeg("photos/".$p);
imagejpeg($image,"",80);
}
?>
This successfully blocks non-members, and lets members see the fullsize image. However, it
doesn't let them see the exact file "photos/image.jpg", instead it creates a copy
with 80% quality - or 90% or 100%, whatever, the point is, it's a copy and not the original.
How can I simply display the fullsize original image without creating a copy, and without getting
blocked by the .htaccess file?