-
-
function photoThumb($p_thumb_file, $p_photo_file, $p_max_size, $p_quality = 75) { -
- $pic = @imagecreatefromjpeg($p_photo_file);
if ($pic) {
- $thumb = @imagecreatetruecolor ($p_max_size, $p_max_size) or die ("画像を作成できません!");
- $width = imagex($pic);
- $height = imagey($pic );
- if ($width < $height) {
- $twidth = $p_max_size;
- $theight = $twidth * $height / $width;
- imagecopyresize($thumb, $pic, 0, 0, 0, ($height/2)-($width/2), $twidth, $theight, $width, $height);
- } else {
- $theight = $p_max_size;
- $twidth = $theight * $width / $height;
- imagecopyresize($thumb, $pic, 0, 0, ($width/2)-($height/2), 0, $twidth, $theight, $width, $height);
- }
ImageJPEG ($thumb, $p_thumb_file, $p_quality);
- }
- }
- ?>
-
复制發
|