Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2006
    Thanked 3 Times in 3 Posts

    Disabling image saving

    I have seen websites that have test.php?file=blah.jpg for example that disables image saving (because it saves as a PHP file and hides the path) yet shows the JPG when it is requested by a browser. How would I go about replicating this?

    EDIT: Renaming it to a jpg displays the real image.. is there any other way through PHP without putting a watermark?
    Last edited by xGIHavoc; 11-04-2009 at 03:02 AM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Thanked 637 Times in 625 Posts
    And how are you going to prevent someone just going to their cache folder and finding the image there?

    Bottom line, if the browser can get it, the user can get it. The only way to prevent image save is to not publish the image.

  • Users who have thanked Fumigator for this post:

    xGIHavoc (11-06-2009)

  • #3
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Some say it's everything.
    Thanked 397 Times in 390 Posts
    There are ways to make the filepath more indirect, but there's always the right click/save as stuff (and incase you are planning to use javascript to block right-clicking you should know that this is EASILY overcome) not to mention something as simple as using a screen capture.

    Anyway, what you mention is really just a PHP page set up to direct file requests based on a database of locations. The script runs on a call to the page - which the browser makes for the image location - and it returns the file location to the browser. Even if the source code doesn't reveal the image location on the server the browser still knows where to find it - just check out Firefox/Firebug. Really, you could get pretty intricate with the implementation and make it virtually impossible for the average joe to find your true image path and these same people could still rip you off with low-tech options.

    Pursuing this method of image "protection" would be a waste of time overall. The only real way to protect an image on the web is to add a water mark.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • Users who have thanked Rowsdower! for this post:

    xGIHavoc (11-06-2009)


    Posting Permissions

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