Made a slight tweak, to remove the link if the image was smaller than or 730px wide:
PHP Code:
/* Start Image RESIZE */
$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
if (@fopen($link, "r"))
{
list($width, $height, $type, $attr) = getimagesize($link);
}
if (stristr($navigator_user_agent, "msie")) {
$image_size_link = '
<img src="' . $link . '" border="0" rel="lightbox" title="'.$link.'" alt="" style="width: expression(this.width > 640 ? 480 : true);" />';
}
else {
$image_size_link = '<img src="' . $link . '" border="0" rel="lightbox" title="'.$link.'" alt="" style="max-width: 730px;" />';
}
if (@fopen($link, "r"))
{
if($width <= 730)
{
$image_size = '<a href="' . $link . '" target="_blank">'.$image_size_link.'</a>';
}
else
{
$image_size = '
<table cellpadding="0" cellspacing="0" border="1">
<tr><td style="background-color:#000000;color:#FFFFFF;">
<a href="' . $link . '" target="_blank" style="color:#FFFFFF;text-decoration:none;">Click to enlarge image</a>
</td></tr>
<tr><td><a href="' . $link . '" target="_blank">' . $image_size_link . '</a></td></tr>
<tr><td style="background-color:#000000;color:#FFFFFF;">
<a href="' . $link . '" target="_blank" style="color:#FFFFFF;text-decoration:none;">Click to enlarge image</a>
</td></tr>
</table>
';
}
return $image_size;
}
/* End Image RESIZE */
requires GD though
also working on getting lightbox2 working with it
ANYONE using My code pre 12:44 20th january 2008 CET please update your code!