zpět na seznam galerií"?>
($src_height/$max_height) ) { $thumb_width = $max_width; $thumb_height = floor($src_height * ($max_width / $src_width)); } else if (($src_width/$max_width) < ($src_height/$max_height) ) { $thumb_height = $max_height; $thumb_width = floor($src_width * ($max_height / $src_height)); } else { $thumb_width = $max_height; $thumb_height = $max_height; } if (!$destImage = imagecreatetruecolor($thumb_width, $thumb_height)) { print ' imagecreatetruecolor('; return false; } if (!imagecopyresampled($destImage, $srcImage, 0, 0, 0, 0, $thumb_width, $thumb_height, $src_width, $src_height)) { print ' imagecopyresampled'; return false; } # image is fixed to supplied width and height and cropped } else if ($scale == false) { $ratio = $max_width / $max_height; # thumbnail is landscape if ($ratio > 1) { # uploaded pic is landscape if ($src_width > $src_height) { $thumb_width = $max_width; $thumb_height = ceil($max_width * ($src_height / $src_width)); if ($thumb_height > $max_width) { $thumb_height = $max_width; $thumb_width = ceil($max_width * ($src_width / $src_height)); } # uploaded pic is portrait } else { $thumb_height = $max_width; $thumb_width = ceil($max_width * ($src_height / $src_width)); if ($thumb_width > $max_width) { $thumb_width = $max_width; $thumb_height = ceil($max_width * ($src_height / $src_width)); } $off_h = ($src_height - $src_width) / 2; } if (!$destImage = imagecreatetruecolor($max_width, $max_height)) { return false; } if (!imagecopyresampled($destImage, $srcImage, 0, 0, 0, $off_h, $thumb_width, $thumb_height, $src_width, $src_height)) { return false; } # thumbnail is square } else { if ($src_width > $src_height) { $off_w = ($src_width - $src_height) / 2; $off_h = 0; $src_width = $src_height; } else if ($src_height > $src_width) { $off_w = 0; $off_h = ($src_height - $src_width) / 2; $src_height = $src_width; } else { $off_w = 0; $off_h = 0; } if (!$destImage = imagecreatetruecolor($max_width, $max_height)) { return false; } if (!imagecopyresampled($destImage, $srcImage, 0, 0, $off_w, $off_h, $max_width, $max_height, $src_width, $src_height)) { return false; } } } imagedestroy($srcImage); if (!imageantialias($destImage, true)) { return false; } if ($type == 3) // cheking image type $r=imagepng($destImage, $thumbnail, $quality); //png elseif ($type == 2) $r=imagejpeg($destImage, $thumbnail, $quality); //jpg elseif ($type == 1) $r=imagegif($destImage, $thumbnail, $quality); //gif imagedestroy($destImage); return true; } ?>