Web Analytics Made Easy -
StatCounter Secured image but save image as works - CodingForum

Announcement

Collapse
No announcement yet.

Secured image but save image as works

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Secured image but save image as works

    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 Code:
    <?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.
    Last edited by m1l; Aug 31, 2011, 03:07 PM.
Working...
X
😀
🥰
🤢
😎
😡
👍
👎