뷰화면에서도 썸네일을 사용하고 싶습니다. 정보
뷰화면에서도 썸네일을 사용하고 싶습니다.본문
아래는 리스트화면에서 섬네일을 형성하는 것인데요...
저는 뷰화면에서도 섬네일을 만들고 싶습니다.
이리저리 애를 써도 도지 않는군요
아래를 어떻게 고쳐야 하는지요.....
----------------------------------
<?
/*
===============
사용가능 변수 설명
===============
<?=$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]));
}
?>
댓글 전체