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.

Hide Image locations using PHP

Discussion in 'PHP' started by apsam29, Dec 22, 2008.

  1. #1
    Hey anybody have some scripts to hide location of image, where they resides.
    I found it some website are blocking original location of that image using PHP based site. :confused:
     
    apsam29, Dec 22, 2008 IP
  2. Yesideez

    Yesideez Peon

    Messages:
    196
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you explain a little more like what you are trying to do?

    I'm not sure I follow with your description so far...
     
    Yesideez, Dec 22, 2008 IP
  3. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #3
    U cannot just hide it
    U can encode your html code, use a lightbox but at the final user can just printscreen and crop ur images
    I recommend u to use a watermarking solution so no one will be interested more on ur images
     
    crivion, Dec 22, 2008 IP
  4. farad

    farad Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can't hide it .. The one and only way is to use them as a Flash movie ;)
     
    farad, Dec 22, 2008 IP
  5. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #5
    You can write a PHP script that outputs the image. Being a PHP script you can add some logic to it so for example if someone is not logged in it won't display the image.

    Example:

    <?php
    // File foo.php
    header("Content-type: image/gif");
    file_get_contents("/home/me/images/blah.gif");
    ?>
    PHP:
    Now you can create the image tag as
    <img src="foo.php" />
     
    phper, Dec 22, 2008 IP
  6. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #6
    You may be able to use mod_rewrite (or whatever similar if not on apache) to cloak the actual urls.
     
    chopsticks, Dec 22, 2008 IP
  7. AT-XE

    AT-XE Peon

    Messages:
    676
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I think he means the way Flickr hides disallows you to save the images.
     
    AT-XE, Dec 23, 2008 IP
  8. farad

    farad Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    <input type="image" src="images/pic1.jpg">
    PHP:
    In this case you will not be able to right click on this image and see it's location :p
     
    farad, Dec 23, 2008 IP
  9. Maxso

    Maxso Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    You meen where the whole page, you can't right click to steal? I have seen that somewhere.
     
    Maxso, Dec 23, 2008 IP
  10. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #10
    You can try and fit a layer with a transperant image on top of the images on your site, that seems to be how flickr does it sometimes. Disabling js still make them possible to copy, but it would be a far better solution.

    The source code reveals the correct image though, for the people going the extra mile to get it, lol.
     
    chopsticks, Dec 23, 2008 IP
  11. justinlorder

    justinlorder Peon

    Messages:
    4,160
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    0
    #11
    If the visitors can review you pictures in browser (eg. IE browser)
    there is a copy of the picture in the "Temporary Internet Files" .
    To protect your images and css is not easy .
     
    justinlorder, Dec 23, 2008 IP
  12. www.hunthost.in

    www.hunthost.in Peon

    Messages:
    147
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I just got a quick idea. Make a file named image.php and put this
    
    <?php
    // File foo.php
    header("Content-type: image/gif");
    if($secretcode == "lolwtf")
    {
    file_get_contents("/home/me/images/blah.gif");
    }
    else
    {
    file_get_contents("/home/me/images/notfound/donttrytosteal.gif");
    }
    ?>
    
    PHP:
    Now in other files like index.php put this ->
    
    <?php
    $secretcode = "lolwtf";
    include('image.php');
    ?>
    
    PHP:
    secret code can be anything, since others dont know it, they cant use to directly link to your images, neither they can view it without index.php opened up.
     
    www.hunthost.in, Dec 23, 2008 IP
  13. spyka

    spyka Greenhorn

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #13
    Would using mod_rewrite work?

    e.g.:
    
    RewriteEngine on
    RewriteRule ^thisfolderdoesntexist/(.+)$ /reallocationofimages/$1
    
    Code (markup):
    messy, you'd have to try it out yourself, but that would hide the hide the location of images like you asked
     
    spyka, Dec 23, 2008 IP
  14. www.hunthost.in

    www.hunthost.in Peon

    Messages:
    147
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    still the image will be saved and others can link to it ;)
     
    www.hunthost.in, Dec 23, 2008 IP
  15. apsam29

    apsam29 Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    :)
    you know most of the websites are having IMAGE directory or directories to store their IMAGE files (like: images/example.jpg, img/banner.gif , etc., ). These files are known to users(visitors) by viewing source code or right click on that image, see from properties - it shows the original location where it found.

    Here Im saying about, how to hide these location(s) from public users. That is there any way to display from indirect location or hiding from public views?

    If u are not much clear about this PM to me ....
     
    apsam29, Dec 23, 2008 IP
  16. apsam29

    apsam29 Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Its a good idea Berserker, you are telling what im expected.
    But I have one doubt on that, can use this code anywhere in PHP scripting?
    Is it possible to use that image display code in <IMG SRC="image.gif"/> here?
     
    apsam29, Dec 23, 2008 IP