rendered paste bodyfunction sed_createthumb($img_big, $img_small, $small_x, $small_y, $keepratio, $extension, $filen, $fsize, $textcolor, $textsize, $bgcolor, $bordersize, $jpegquality, $dim_priority="Width") { if (!function_exists('gd_info')) { return; } global $cfg; $gd_supported = array('jpg', 'jpeg', 'png', 'gif'); switch($extension) { case 'gif': $source = imagecreatefromgif($img_big); break; case 'png': $source = imagecreatefrompng($img_big); break; default: $source = imagecreatefromjpeg($img_big); break; } $big_x = imagesx($source); $big_y = imagesy($source); if ($big_y > $big_x) { // If the width is greater than the height it's a horizontal picture $xoord = ceil(($big_x - $big_y) / 2 ); $big_y = $big_x; // Then we read a square frame that equals the width } else { $yoord = ceil(($big_y - $big_x) / 2); $big_x = $big_y; } $thumb_x = $small_x; $thumb_y = $small_y; $new = imagecreatetruecolor($thumb_x, $thumb_y); imagecopyresampled($new, $source, $bordersize, $bordersize, $xoord, $yoord, $thumb_x, $thumb_y, $big_x, $big_y switch($extension) { case 'gif': imagegif($new, $img_small); break; case 'png': imagepng($new, $img_small); break; default: imagejpeg($new, $img_small, $jpegquality); break; } imagedestroy($new); imagedestroy($source); return; }