갤러리 소스에서 세로크기가 제어가 안되요
세로크기를 100으로 맞춰도.
무작정 커지네요.
파일첨부합니다.
주소입니다.
첨부파일
|
댓글을 작성하시려면 로그인이 필요합니다.
로그인
댓글 3개
아래거는 서로다른 이미지를 원본이미지를 최소로 훼손하지 않고 같은 크기로 resize image 화 합니다. ... 출처~ 불명~
<?php
$image = $_REQUEST['image'];
$max_width = $_REQUEST['max_width'];
$max_height = $_REQUEST['max_height'];
if (!$max_width)
$max_width = 80;
if (!$max_height)
$max_height = 60;
$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if ( ($width <= $max_width) && ($height <= $max_height) ) {
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio * $height) < $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header('Content-type: image/jpeg');
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);
?>
<?
// 이미지
echo "<a href='{$list[$i][href]}'>";
$image = urlencode($list[$i][file][0][file]);
if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
echo '<img src="../m_shop/image_size.php?image=';
echo "$g4[path]/data/file/$bo_table/$image";
echo '&max_width=120&max_height=200" border=0 align = left>';
echo "</a>";
}
else if (!file_exists($list[$i][file_image0])){
echo "no image file";
}
?>