vrflyer Posted March 14, 2006 Posted March 14, 2006 So after couple years of "it" running ok - now it will not work whe creating a THUMB of a pic from any linked URL. >// Start function getsize($url) { global $userdata; // Maximum width and height for inpost images leave one of them as 0 to keep the right dimensions. $iWidth = 200; $iHeight = 0; // JPEG Quality $quality = 85; $base = basename($url); $base_ext = substr($base, 0, -4); $id = $userdata['username'] . "_" . $base_ext; // broken_link $broken_link = $phpbb_root_path . "images/no_pic.jpg"; if(@!$size = getimagesize($url)) { return $broken_link; } $img_size = getimagesize($url); $real_width = $img_size[0]; $real_height = $img_size[1]; if($real_width > $iWidth OR $real_height > $iHeight) { // Find the height or width if 0 is the value. if($iHeight == 0) { $percent = $size[1] / $size[0] * 100; $iHeight = round($iWidth / 100 * $percent, 0); } if($iWidth == 0) { $percent = $size[0] / $size[1] * 100; $iWidth = round($iHeight / 100 * $percent, 0); } // Look up the extension of the image and use the right functions. $cut_url = strlen($url) - 3; $ext = substr($url, $cut_url); // .jpg if($ext == "jpg") { $im = imagecreatefromjpeg($url); $ow = imagesx( $im ); $oh = imagesy( $im ); $wscale = $iWidth / $ow; $hscale = $iHeight / $oh; $scale = ( $hscale < $wscale ? $hscale : $wscale ); $nw = round( $ow * $scale, 0 ); $nh = round( $oh * $scale, 0 ); $dstim = imagecreatetruecolor( $nw, $nh ); imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh ); imagejpeg( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".jpg", $quality); imagedestroy( $dstim ); $thumb = $id . ".jpg"; // .gif } elseif($ext == "gif") { $im = imagecreatefromgif($url); $ow = imagesx( $im ); $oh = imagesy( $im ); $wscale = $iWidth / $ow; $hscale = $iHeight / $oh; $scale = ( $hscale < $wscale ? $hscale : $wscale ); $nw = round( $ow * $scale, 0 ); $nh = round( $oh * $scale, 0 ); $dstim = imagecreatetruecolor( $nw, $nh ); imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh ); imagejpeg( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".gif"); imagedestroy( $dstim ); $thumb = $id . ".gif"; // .png } elseif($ext == "png") { $im = imagecreatefrompng($url); $ow = imagesx( $im ); $oh = imagesy( $im ); $wscale = $iWidth / $ow; $hscale = $iHeight / $oh; $scale = ( $hscale < $wscale ? $hscale : $wscale ); $nw = round( $ow * $scale, 0 ); $nh = round( $oh * $scale, 0 ); $dstim = imagecreatetruecolor( $nw, $nh ); imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh ); imagepng( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".png"); imagedestroy( $dstim ); $thumb = $id . ".png"; // Hvis det skulle være .php endelser! } elseif($ext == "php") { $iUrl = $lang['no_php']; return $iUrl; // Ellers kan billedet ikke virke! } else { return $broken_link; } } $iUrl = "[" . $phpbb_root_path . "images/thumbs/" . $thumb . "]" . $url; // Hvis billedet nu ikke er for stort! if($real_width < $iWidth && $real_height < $iHeight) { $iUrl = "[" . $url . "]" . $url; } return $iUrl; } Any ideas on your end>? Quote
TCH-Bruce Posted March 14, 2006 Posted March 14, 2006 If you have done no changes to the script and it's no longer working please open a ticket with the help desk and ask the techs to investigate. Link at top of page or in my signature. Quote
vrflyer Posted March 15, 2006 Author Posted March 15, 2006 (edited) ....and out of no where it's started working as of this morning - weird. Edited March 15, 2006 by vrflyer Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.