check if image is hotlinkable

Discussion in 'PHP' started by smellocity, Mar 24, 2010.

  1. #1
    Hello, I have a website that uses google images to show images on my site. SOmetimes images dont show up if they are hotlink protected. How can I test this using php?

    I tried if file exist and that doesnt work because the file exist, you just can view it on your webpage.
    I also try using php image size to test the size but that did not work...

    any ideas?
     
    smellocity, Mar 24, 2010 IP
  2. angelomaniac

    angelomaniac Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    it's a little bit tricky since the server will return various type of image to protect hotlinking.

    Perhaps you should grab the image using cURL, the server won't recognize it as a hotlinking. but it's a little bit difficult and will take more resources.
     
    angelomaniac, Mar 24, 2010 IP
  3. foxbsd

    foxbsd Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    the holinking is protected obvious. 1. give up the image 2. grab the image using curl ( forge the http referer header as ie, firefox)
     
    foxbsd, Mar 24, 2010 IP
  4. smellocity

    smellocity Active Member

    Messages:
    155
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    88
    #4
    so I should use curl to call googles web service? or run the iamge through curl?
     
    smellocity, Mar 25, 2010 IP