뷰화면에서도 썸네일을 사용하고 싶습니다.
아래는 리스트화면에서 섬네일을 형성하는 것인데요...
저는 뷰화면에서도 섬네일을 만들고 싶습니다.
이리저리 애를 써도 도지 않는군요
아래를 어떻게 고쳐야 하는지요.....
----------------------------------
<?
/*
===============
사용가능 변수 설명
===============
<?=$bo_table?> // 테이블명
<?=$reldir?> // 상대경로
<?=$bbsdir?> // 상대경로
<?=$wr_subject?> // 게시물 제목
<?=$wr_date?> // 게시물 일시 (원본 : $row[wr_datetime])
<?=$a_list_link?> // 게시물 링크
*/
$mmdd = substr($wr_date, 3, 5);
$tg="target='_blank'";
//$lenth=33;//글내용 글자수 조정
//$wr_content = get_text(cut_str($row[wr_content], $lenth, '...'));
$thumbx = 175 ;
$thumby = 150 ;
// 이미지파일의 x, y 사이즈 계산하여 리턴
function mandoV7_image_size($x, $y, $thumbx, $thumby) {
if($x > $thumbx) {
$overx = ($x - $thumbx) / $x;
$x = $thumbx;
$y = intval($y - ($y * $overx));
}
if($y > $thumby) {
$overy = ($y - $thumby) / $y;
$y = $thumby;
$x = intval($x - ($x * $overy));
}
return array('x'=>$x, 'y'=>$y);
}
for($i=0; $i<count($list); $i++) {
$destfile = $list[$i][file_image1].'mandoThumbV7';
$size = getimagesize($list[$i][file_image1]);
if(is_array($size) && !is_file($destfile)) {
switch($size[2]) {
case(1) :
if(function_exists('ImageCreateFromGif')) $im = ImageCreateFromGif($list[$i][file_image1]);
break;
case(2) :
if(function_exists('ImageCreateFromJpeg')) $im = ImageCreateFromJpeg($list[$i][file_image1]);
break;
case(3) :
if(function_exists('ImageCreateFromPng')) $im = ImageCreateFromPng($list[$i][file_image1]);
break;
}
$fixsize = mandoV7_image_size($size[0], $size[1], $thumbx, $thumby);
if($im) {
if($i==0) @exec("rm ".dirname($_SERVER[SCRIPT_FILENAME])."/data/file/$bo_table/*mandoThumbV7 -rf");
if(function_exists('ImageCreateTrueColor')) $newim = ImageCreateTrueColor($fixsize[x],$fixsize[y]);
else $newim = ImageCreate($fixsize[x],$fixsize[y]);
if(function_exists('ImageCopyResampled')) ImageCopyResampled($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
else ImageCopyResized($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
ImageDestroy($im);
ImageJpeg($newim, $destfile, 90);
ImageDestroy($newim);
unset($im, $newim);
}
$list[$i][img][x] = $fixsize[x];
$list[$i][img][y] = $fixsize[y];
} else {
if(is_file($destfile)) {
$size = getimagesize($destfile);
$list[$i][img][x] = $size[0];
$list[$i][img][y] = $size[1];
} else {
$list[$i][file_image1] = "$latest_skin/noimg.gif";
$size = getimagesize($list[$i][file_image1]);
$list[$i][img][x] = $size[0];
$list[$i][img][y] = $size[1];
}
}
if(is_file($destfile)) $list[$i][file_image1] = $destfile;
// if(time()-(60*60*24) = strtotime($list[$i][wr_datetime])) $list[$i][date] = date('H:i',strtotime($list[$i][wr_datetime]));
// else $list[$i][date] = date('Y.m.d',strtotime($list[$i][wr_datetime]));
}
?>
저는 뷰화면에서도 섬네일을 만들고 싶습니다.
이리저리 애를 써도 도지 않는군요
아래를 어떻게 고쳐야 하는지요.....
----------------------------------
<?
/*
===============
사용가능 변수 설명
===============
<?=$bo_table?> // 테이블명
<?=$reldir?> // 상대경로
<?=$bbsdir?> // 상대경로
<?=$wr_subject?> // 게시물 제목
<?=$wr_date?> // 게시물 일시 (원본 : $row[wr_datetime])
<?=$a_list_link?> // 게시물 링크
*/
$mmdd = substr($wr_date, 3, 5);
$tg="target='_blank'";
//$lenth=33;//글내용 글자수 조정
//$wr_content = get_text(cut_str($row[wr_content], $lenth, '...'));
$thumbx = 175 ;
$thumby = 150 ;
// 이미지파일의 x, y 사이즈 계산하여 리턴
function mandoV7_image_size($x, $y, $thumbx, $thumby) {
if($x > $thumbx) {
$overx = ($x - $thumbx) / $x;
$x = $thumbx;
$y = intval($y - ($y * $overx));
}
if($y > $thumby) {
$overy = ($y - $thumby) / $y;
$y = $thumby;
$x = intval($x - ($x * $overy));
}
return array('x'=>$x, 'y'=>$y);
}
for($i=0; $i<count($list); $i++) {
$destfile = $list[$i][file_image1].'mandoThumbV7';
$size = getimagesize($list[$i][file_image1]);
if(is_array($size) && !is_file($destfile)) {
switch($size[2]) {
case(1) :
if(function_exists('ImageCreateFromGif')) $im = ImageCreateFromGif($list[$i][file_image1]);
break;
case(2) :
if(function_exists('ImageCreateFromJpeg')) $im = ImageCreateFromJpeg($list[$i][file_image1]);
break;
case(3) :
if(function_exists('ImageCreateFromPng')) $im = ImageCreateFromPng($list[$i][file_image1]);
break;
}
$fixsize = mandoV7_image_size($size[0], $size[1], $thumbx, $thumby);
if($im) {
if($i==0) @exec("rm ".dirname($_SERVER[SCRIPT_FILENAME])."/data/file/$bo_table/*mandoThumbV7 -rf");
if(function_exists('ImageCreateTrueColor')) $newim = ImageCreateTrueColor($fixsize[x],$fixsize[y]);
else $newim = ImageCreate($fixsize[x],$fixsize[y]);
if(function_exists('ImageCopyResampled')) ImageCopyResampled($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
else ImageCopyResized($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
ImageDestroy($im);
ImageJpeg($newim, $destfile, 90);
ImageDestroy($newim);
unset($im, $newim);
}
$list[$i][img][x] = $fixsize[x];
$list[$i][img][y] = $fixsize[y];
} else {
if(is_file($destfile)) {
$size = getimagesize($destfile);
$list[$i][img][x] = $size[0];
$list[$i][img][y] = $size[1];
} else {
$list[$i][file_image1] = "$latest_skin/noimg.gif";
$size = getimagesize($list[$i][file_image1]);
$list[$i][img][x] = $size[0];
$list[$i][img][y] = $size[1];
}
}
if(is_file($destfile)) $list[$i][file_image1] = $destfile;
// if(time()-(60*60*24) = strtotime($list[$i][wr_datetime])) $list[$i][date] = date('H:i',strtotime($list[$i][wr_datetime]));
// else $list[$i][date] = date('Y.m.d',strtotime($list[$i][wr_datetime]));
}
?>
게시판 목록
그누3질답
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 15년 전 | 7783 | ||
| 9403 | 19년 전 | 3509 | ||
| 9402 | 19년 전 | 4086 | ||
| 9401 | 19년 전 | 3516 | ||
| 9400 | 19년 전 | 3605 | ||
| 9399 | 19년 전 | 3882 | ||
| 9398 |
나뚜루메론
|
19년 전 | 3164 | |
| 9397 |
dinga
|
19년 전 | 3586 | |
| 9396 | 19년 전 | 3327 | ||
| 9395 | 19년 전 | 3256 | ||
| 9394 | 19년 전 | 4304 | ||
| 9393 | 19년 전 | 3707 | ||
| 9392 |
|
19년 전 | 3131 | |
| 9391 | 19년 전 | 3200 | ||
| 9390 | 19년 전 | 3489 | ||
| 9389 | 19년 전 | 4449 | ||
| 9388 | 19년 전 | 3121 | ||
| 9387 | 19년 전 | 3722 | ||
| 9386 | 19년 전 | 3364 | ||
| 9385 | 19년 전 | 3236 | ||
| 9384 | 19년 전 | 3905 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기