...

View Full Version : Secured image but save image as works



m1l
08-31-2011, 05:57 PM
Hi,

I am trying to secure some images, so you have to login before being able to view them, I have this working, so I have this



<?php
include('login_redirect.php');
$path = '/home/sitename/downloads/';

if (is_file($path . $_GET['f'])) {
$f = $path . $_GET['f'];
} else {
$f = $path . 'not_found.jpg';
}

header('Content-type: image/jpeg');
$im = @ImageCreateFromJPEG ($f) or // Read JPEG Image
@ImageJPEG($im);
?>

This output the image to the page, which is a good start but I need it so the right click and 'Save image as' to work, it works but the filename is the name of the PHP file, so images.php for example and I need it to be the so that if the URL is

images.php?f=ml.jpg

it should ask me to save ml.jpg

Any pointers are really appreciated.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum