Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    m1l
    m1l is offline
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    0
    Thanked 1 Time in 1 Post

    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; 08-31-2011 at 08:07 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •