...

View Full Version : Check if hotlink is allowed



gani
05-22-2011, 12:01 AM
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?

Jinxy
05-22-2011, 06:32 PM
You could do something like this:



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:



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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum