Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2008
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check if hotlink is allowed

    I have a script that loads images from other websites.

    But occasionally, one of the hotlinked images is protected by the owner and it does not display on my website. is there any way for me to find out if an image is protected against hotlinking so that I do not try to display it?

  • #2
    New Coder
    Join Date
    Feb 2007
    Posts
    86
    Thanks
    0
    Thanked 2 Times in 2 Posts
    You could do something like this:

    PHP Code:
    foreach( $url as $temp )
    {
    if ( 
    getimagesize($temp) )
    {
    echo 
    "<img src=\"$temp\">";
    }

    This will only tell you if it's an image. If the site returns a hotlink image this won't help you.

    You could also do this if you wanted to get the width and height:

    PHP Code:
    foreach( $url as $temp )
    {
    if ( 
    $dim getimagesize($temp) )
    {
    echo 
    "<img src=\"$temp\" width=\"$dim[0]\" height=\"$dim[1]\" border=\"0\">";
    }



  •  

    Posting Permissions

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