Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Password protect images

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #31733
    theeal
    Member

    I have problems to password protect images, it don’t show any picture…
    then I try it, my browser console say:
    “Resource interpreted as document but transferred with MIME type image/jpeg.”
    Any Idea?


    //Usage:


    session_start();

    $path = '/path/to/images/';

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

    if ($_SESSION == false) {
    $f = $path . 'req_auth.jpg';
    }

    header('Content-type: image/jpeg');

    $im = @ImageCreateFromJPEG ($f) or // Read JPEG Image
    $im = @ImageCreateFromPNG ($f) or // or PNG Image
    $im = @ImageCreateFromGIF ($f) or // or GIF Image
    $im = false; // If image is not JPEG, PNG, or GIF

    if (!$im) {
    readfile ($f);
    } else {
    @ImageJPEG($im);
    }
    ?>
Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.