1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

++Best idea to protect image ,can anyone code this++

Discussion in 'PHP' started by jasimjatjasim2, Sep 10, 2009.

  1. caprichoso

    caprichoso Well-Known Member

    Messages:
    433
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #21
    That's hotl inking yet. And you can take the image with you if you want to:

    [​IMG]

    I think jasimjatjasim2 wants something different but he doesn't want to explain. :)
     
    caprichoso, Sep 13, 2009 IP
  2. jasimjatjasim2

    jasimjatjasim2 Active Member

    Messages:
    180
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #22
    the thing is that


    I wil start with one example
    suppose my website is example.com
    my image name is dp.jpg
    the image dp.jpg is on the folder images_uploaded/images
    so i can access the image through
    Code:

    http://www.example.com/images_uploaded/images/dp.jpg

    so to insert that image i need to enter the following code
    Code:

    <img src="http://www.example.com/images_uploaded/images/dp.jpg">

    If we can create a php file called showimage.php
    and if we use
    Code:

    <img src="http://www.example.com/showimage.php?(some random string)/images/dp.jpg">

    then it should show the image
    Code:

    http://www.example.com/images_uploaded/images/dp.jpg

    if some one copy the image location which is
    Code:

    http://www.example.com/showimage.php?(some random string)/images/dp.jpg

    it should show only some error mesage or some thing but not the image

    so the users will not able to find the real directory name which the image contain

    so can some one develop a php file called showimage.php which works like i explaned above

    so the image should only display when it is in img tag else it should display some error message
     
    jasimjatjasim2, Sep 13, 2009 IP
  3. caprichoso

    caprichoso Well-Known Member

    Messages:
    433
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #23
    You can create a PHP which hides the real location of your images and then it only shows them when $_SERVER['REFERRER'] value is set for the domain/domains you want. That's hot linking and easy to do in PHP. But that wont prevent anyone of downloading your images. And, since some buggy firewalls replace REFERRER HTTP field with garbage, some user won't be able to see your image even when linked from IMG tag from one of your own pages.

    Hot linking saves your band width as nobody can use your images right from your web server. But is useless protecting the images themselves.
     
    caprichoso, Sep 13, 2009 IP
  4. gamelover

    gamelover Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    Of course, If you see an image in a browser, you can take it with right click and save as.

    I only give an example above.

    If you want to not let others to give hotlink to your images, I think my solution is ok
    But if jasimjatjasim2 says
    "these images are mine and nobody can download my images to their computers"
    In my opinion Only solution is flash. Isn't it?
     
    gamelover, Sep 14, 2009 IP
  5. gamelover

    gamelover Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    And of course,
    according to jasimjatjasim2 explanation, It is easy to develop a PHP file which generate a random text and keep image files in another directory.
    it can show images with
    example.com/showimage.php?(some random string)/images/dp.jpg
    but in fact the image file's dir is myfiles/uploads/images/dp.jpg
    This is easy to develop, So what is the problem? :D
     
    gamelover, Sep 14, 2009 IP
  6. caprichoso

    caprichoso Well-Known Member

    Messages:
    433
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #26
    You are right. Your solution is preventing hotlink.

    Flash can be just another obstacle. As preventing hot linking is.
    If your flash movie loads the image dynamically, the image file will end up in browser's cache. And detecting the URL of the image (even is it's a PHP) would be pretty easy.
    You could create a Flash movie with the image inside. That would be better, but the user can always take a screen shot for that matter.

    In this cases you have to take a look to what big-companies are doing. Image stock sites show you thumbnails with watermark logos on it.
    [​IMG]
     
    caprichoso, Sep 14, 2009 IP
  7. Deus Ex

    Deus Ex Peon

    Messages:
    531
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #27
    This should work for you -- I say also ensure the container is cloaked and that the showimage script is extremely not able to be hacked, you may find yourself getting ddos attacks on your script...

     
    Deus Ex, Sep 14, 2009 IP
  8. caprichoso

    caprichoso Well-Known Member

    Messages:
    433
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #28
    A good idea indeed. But yet another hotlink preventer. It's much better that just checking the referrer. But it would let all your users without images if the are over a slow connection. Twenty second is too fast to HTTP :)
     
    caprichoso, Sep 15, 2009 IP
  9. gamelover

    gamelover Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #29
    Ä°t is not necessary checking with time stamp. You could kill session in image.php so slow connection users will not be effected.
     
    gamelover, Sep 16, 2009 IP