//
// Turns an URL from the [img] tag into an
tag or a tag
//
function handle_img_tag($url, $is_signature = false)
{
global $lang_common, $pun_config, $pun_user;
$img_tag = '<'.$lang_common['Image link'].'>';
if ($is_signature && $pun_user['show_img_sig'] != '0')
$img_tag = '
';
else if (!$is_signature && $pun_user['show_img'] != '0')
{
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
$new_image = ImageCreateFromString($file_contents);
imagejpeg($new_image, "temp.jpg",100);
// Get new dimensions
$myfilesize = getimagesize("temp.jpg");
$width_orig = $myfilesize[0];
$height_orig = $myfilesize[1];
if ($myfilesize)
{
$width = $myfilesize[0];
$height = $myfilesize[1];
$img_tag = '
';
if ($width > 550)
{
$img_tag = '' . $img_tag . '';
}
}
else
{
$img_tag = 'error: image ' . $url . ' cannot be loaded.';
}
}