썸네일 설정시 세로비율 정보
썸네일 설정시 세로비율본문
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$latest_skin_path/img/no_image.gif' border=1 width='$img_width' height='$img_height' title='이미지 없음' align=left style='margin-right:5px; border:1 #222222 solid;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
{
$img = "<img src='$latest_skin_path/img/no_image.gif' border=1 width='$img_width' height='$img_height' title='이미지 없음' align=left style='margin-right:5px; border:1 #222222 solid;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=1 align=left style='margin-right:5px; border:1 #222222 solid;'>";
?>
$img = "<img src='$thumb' border=1 align=left style='margin-right:5px; border:1 #222222 solid;'>";
?>
썸네일 소스입니다.
이미지의 비율에따라서 세로에 많은 영향을 받습니다.
긴이미지라면 비율에 맞춰서 세로가 너무 짧게 표현됩니다.
이미지 양옆을 자르더라도 비율을 못지키더라도 다른방법으로
크기를 지키고싶습니다. 리사이즈같은 형식 말고요 .
이왕이면 crop이던가 .. 얼리어답터사이트처럼 확대되는거였으면 더 좋겠습니다.
방법좀 알려주세요 . 이문제로 지금 몇시간째 싸우는지 모르겠습니다. ㅠㅠ..
아 그리고 .. 검색창 외부로 빼려면 어떻게해야하나요 ?
<?=search('bagic')?> 뭐 이런거없나요 ? ㅠㅠ 에고답답하당
댓글 전체
http://sir.co.kr/bbs/tb.php/g4_skin/41418
검색창을 외부로 뺄려면.. ^^;
<form name="fsearchbox" method="get" action="javascript:fsearchbox_submit(document.fsearchbox);" style="margin:0px;" autocomplete="off">
<input type="hidden" name="sfl" value="wr_subject">
<input type="hidden" name="sop" value="and">
<input type=text size=20 class=ed name=stx style='height:17px;' tabindex=1>
<input type=image src='../img/search.gif' border=0 width=33 height=16 align="absmiddle">
</form>
요소스를 넣으시고
'../img/search.gif' 이부분을 적절히 마추시면 될겁니다
검색창을 외부로 뺄려면.. ^^;
<form name="fsearchbox" method="get" action="javascript:fsearchbox_submit(document.fsearchbox);" style="margin:0px;" autocomplete="off">
<input type="hidden" name="sfl" value="wr_subject">
<input type="hidden" name="sop" value="and">
<input type=text size=20 class=ed name=stx style='height:17px;' tabindex=1>
<input type=image src='../img/search.gif' border=0 width=33 height=16 align="absmiddle">
</form>
요소스를 넣으시고
'../img/search.gif' 이부분을 적절히 마추시면 될겁니다