All pastes #399321 Raw Edit

Something

public php v1 · immutable
·published 2007-03-17 22:54 UTC
rendered paste body
//// Turns an URL from the [img] tag into an <img> tag or a <a href...> tag//function handle_img_tag($url, $is_signature = false){	global $lang_common, $pun_config, $pun_user;	$img_tag = '<a href="'.$url.'">&lt;'.$lang_common['Image link'].'&gt;</a>';	if ($is_signature && $pun_user['show_img_sig'] != '0')		$img_tag = '<img class="sigimage" src="'.$url.'" alt="'.htmlspecialchars($url).'" />';	else if (!$is_signature && $pun_user['show_img'] != '0')	{		$imagehw = @getimagesize($url);		if ($imagehw)		{			$width = $imagehw[0];			$height = $imagehw[1];			$img_tag = '<img class="postimg" src="'.$url.'" alt="'.htmlspecialchars($url).'" />';			if ($width > 550)			{				$img_tag = '<a href="'.$url.'" rel="lightbox">'  .  $img_tag  .  '</a>';			}		}		else		{			$img_tag = '<strong>error: image ' . $url . ' cannot be loaded.</strong>';		}	}	return $img_tag;}