Results 1 to 7 of 7

Thread: Protecting Images Using PHP and htaccess

  1. #1
    Moderator Bec's Avatar
    Join Date
    Nov 2003
    Location
    Ohio
    Posts
    8,419

    Protecting Images Using PHP and htaccess

    I won't reprint the entire tutorial but the topics below will show you what menthods Michael Irwin will teach you to implement in his Protecting Images Using PHP and htaccess article.

    ****
    Image protection on the internet can be quite tough. With view source, and tools like Firebug, it takes a combination of tactics. In this article, we'll go over a few techniques that can be used.

    Sources to check

    In this article, we're going to tackle a few different tactics to safeguard images. But, let's first think about what ways people can get images.

    * Direct path - if a user knows the path to an image, they can simply go straight to it, and download the image.
    * Drag and drop - in most browsers today, you can simply drag and drop an image right onto your desktop.
    * Hotlinking - another website can link directly to your image
    * Screenshot - a visitor can simply take a screenshot of your page and crop the image.

    How to fix them


    So, now that we've established where our problems are, how can we fix them?

    * Direct path - we're going to create a PHP script to "hide" the direct path.
    * Drag and drop - we're going to implement something that Flickr does... placing a 1x1 transparent GIF on top of the image.
    * Hotlinking - using .htaccess, we can prevent hotlinking from occurring
    * Screenshot - not much you can do here. The best recommendation I have is to add a watermark to your image (not covered in this tutorial)

    Read the rest of the Tutorial

    *****

    I thought that transparent gif method was a great tip!


  2. #2
    How long have you been gay? Three hundred and sixty-five had come and went
    Join Date
    Nov 2006
    Location
    Europe
    Posts
    530
    It's a nice tutorial, but why wasting the time to do all this if everything you need to download images is your browser's cache? There is FF addon called CacheViewer that let's you conveniently browser your cache, preview the files and save them directly to your preferred folder. I often used it to download banner from sponsors if they don't offer a zip file and it saves me from downloading each banner separately.

    The only work I can see some sense in, is protecting against hotlinking, but all the other stuff really won't do the trick unless there is a way of keeping the browser's cache out of the game.


  3. #3
    Moderator Bec's Avatar
    Join Date
    Nov 2003
    Location
    Ohio
    Posts
    8,419
    Would that browser cache method still get images using the transparent gif?


  4. #4
    Life is a dick and when itīs get hard---just fuck it... DEVELISH's Avatar
    Join Date
    Jul 2005
    Posts
    2,367
    Quote Originally Posted by Bec View Post
    Would that browser cache method still get images using the transparent gif?
    it should since the browser cache caches all files it downloads - hence background and foreground images
    (I have not read the tutorial though)
    :-D


  5. #5
    Moderator Bec's Avatar
    Join Date
    Nov 2003
    Location
    Ohio
    Posts
    8,419
    Found this on eHow: How to Stop a Web Page From Caching. It was written May 2010, so don't know if it currently works with newer browsers and applications like the Cache Viewer.

    #1

    Open your web page file in your HTML text editor. You can use any plain text editor such as Notepad. Scroll to the section of the file between the "<head>" and "</head>" tags. This is where your meta tags are located.

    #2

    Enter the first meta tag. The first meta tag is the "expires" specification. This is a date set in the past. It instructs the browser that the content has expired each time it determines to cache the web page. An expiration date in the past forces the browser to query for a new page each time the user navigates to the website. The following code sets the expiration meta tag:

    <meta http-equiv = "expires" value = "Wed, 22 Dec 2009 12:00:00 GMT" />

    #3

    Set the "no cache" meta tag. This tag is also used to restrict browsers that may not support the "Expires" meta tag. This tag is also used by mobile phones, so cellular users do not cache the web page. Enter the following code into your page:

    <meta http-equiv = "pragma" content = "no-cache" />

    Read more: How to Stop a Web Page From Caching | eHow.com http://www.ehow.com/how_6544958_stop...#ixzz1GPKiiKlf


  6. #6
    I've got more gay in my little pinky, than you have in your entire body
    Join Date
    Jul 2007
    Posts
    195
    All resistance is futile. :-)

    You can just make screencaps (has happened to my sites more than once over the years). I used to use a Java app that prevented any copying, but in the end I just gave up. It annoys legit members, and the ones who want to copy will do so anyway.
    Bert

    TwinkPay
    Skype: asiagayboy
    ICQ: 586-290-229


  7. #7
    How long have you been gay? Three hundred and sixty-five had come and went
    Join Date
    Nov 2006
    Location
    Europe
    Posts
    530
    Quote Originally Posted by Bec View Post
    Found this on eHow: How to Stop a Web Page From Caching. It was written May 2010, so don't know if it currently works with newer browsers and applications like the Cache Viewer.
    Would be intersting to find out if this works. However, it just sounds too easy and I guess a lot of websites would be using those tags if it would prevent the browser from caching.

    Also I wouldn't like the forced reload as there are still many surfers with slow connections and it could be very annoying and maybe drive away visitors and potential customers.


Posting Permissions

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