이미지 썸네일로 출력하기 도움을 부탁드립니다. 제발~ 정보
이미지 썸네일로 출력하기 도움을 부탁드립니다. 제발~본문
최신글을 플래시로 출력하는 소스를 받았는데요.
이미지가 썸네일로 출력이 되지를 않네요.
이 부분만 해결되면 스킨을 다양하게 만들수 있을것 같은데요.
회원님들의 도움 부탁드립니다.
스킨으로 보답하겠습니다.
제가 짜집기한 소스인데요, 문제가 없어 보이는데 이미지가 출력이 안되네요. 회원님들의 도움을 부탁드립니다. 꾸벅~
<?
if (!defined("_GNUBOARD_")) exit;
?>
<table width='300' bgcolor='#ffffff' cellpadding='0' cellspacing='0' border='0'>
<tr><td>
<? for ($i=0; $i<count($list); $i++) {
$la_content = "65"; //내용길이
$img_w = "310"; //썸네일 가로
$img_h = "80"; //썸네일 세로
$data_path = $g4[path]."/data/file/$bo_table/";
$thumb_path = $data_path.'/thumb_'.$img_w.'_'.$img_h;
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
//썸네일 코드 시작
$img = "<div style='width:100px;height:55px;'></div>";
$thumb = $thumb_path . '/' . $list[$i][file][0][file] . '.thumb';
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
continue;
$rate = $img_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $img_h)
$dst = imagecreatetruecolor($img_w, $height);
else
$dst = imagecreatetruecolor($img_w, $img_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 99);
chmod($thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 0606);
}
}
if (file_exists($thumb))
$image = "<img src='$thumb' align='absmiddle' border='0' >";
?>
<tr><td><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'
width='300' height='68' id='latest_1' align=''>
<param name='movie' value='<?=$latest_skin_path?>/latest_1.swf?path=<?=$g4[bbs_path]?>'>
<param name='quality' value='high'>
<param name='bgcolor' value='#ffffff'>
<param name='flashvars' value="subject=<?=$list[$i][subject]?> <?=$list[$i][comment_cnt]?>&date=<?=$list[$i][datetime]?>&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&filename=<?=$image?>&count=<?=cut_str($list[$i][wr_content],34,"…");?>">
<embed src='<?=$latest_skin_path?>/latest_1.swf?path=<?=$g4[bbs_path]?>' flashvars="subject=<?=$list[$i][subject]?><?=$list[$i][comment_cnt]?>&date=<?=$list[$i][datetime]?>&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&filename=<?=$image?>&count=<?=cut_str($list[$i][wr_content],34,"…");?>" quality='high' bgcolor='#ffffff' width='300' height='68' name='latest_1' align='' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></td></tr>
<? } ?>
</table>
이미지가 썸네일로 출력이 되지를 않네요.
이 부분만 해결되면 스킨을 다양하게 만들수 있을것 같은데요.
회원님들의 도움 부탁드립니다.
스킨으로 보답하겠습니다.
제가 짜집기한 소스인데요, 문제가 없어 보이는데 이미지가 출력이 안되네요. 회원님들의 도움을 부탁드립니다. 꾸벅~
<?
if (!defined("_GNUBOARD_")) exit;
?>
<table width='300' bgcolor='#ffffff' cellpadding='0' cellspacing='0' border='0'>
<tr><td>
<? for ($i=0; $i<count($list); $i++) {
$la_content = "65"; //내용길이
$img_w = "310"; //썸네일 가로
$img_h = "80"; //썸네일 세로
$data_path = $g4[path]."/data/file/$bo_table/";
$thumb_path = $data_path.'/thumb_'.$img_w.'_'.$img_h;
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
//썸네일 코드 시작
$img = "<div style='width:100px;height:55px;'></div>";
$thumb = $thumb_path . '/' . $list[$i][file][0][file] . '.thumb';
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
continue;
$rate = $img_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $img_h)
$dst = imagecreatetruecolor($img_w, $height);
else
$dst = imagecreatetruecolor($img_w, $img_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 99);
chmod($thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 0606);
}
}
if (file_exists($thumb))
$image = "<img src='$thumb' align='absmiddle' border='0' >";
?>
<tr><td><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'
width='300' height='68' id='latest_1' align=''>
<param name='movie' value='<?=$latest_skin_path?>/latest_1.swf?path=<?=$g4[bbs_path]?>'>
<param name='quality' value='high'>
<param name='bgcolor' value='#ffffff'>
<param name='flashvars' value="subject=<?=$list[$i][subject]?> <?=$list[$i][comment_cnt]?>&date=<?=$list[$i][datetime]?>&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&filename=<?=$image?>&count=<?=cut_str($list[$i][wr_content],34,"…");?>">
<embed src='<?=$latest_skin_path?>/latest_1.swf?path=<?=$g4[bbs_path]?>' flashvars="subject=<?=$list[$i][subject]?><?=$list[$i][comment_cnt]?>&date=<?=$list[$i][datetime]?>&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&filename=<?=$image?>&count=<?=cut_str($list[$i][wr_content],34,"…");?>" quality='high' bgcolor='#ffffff' width='300' height='68' name='latest_1' align='' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></td></tr>
<? } ?>
</table>
댓글 전체
테스트 할 상황이 아니라서 죄송..
imagepng($dst, $thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 99);
를
imagejpeg($dst, $thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 99);
로 바꿔보세요,
imagepng($dst, $thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 99);
를
imagejpeg($dst, $thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 99);
로 바꿔보세요,
모바일님 답변감사합니다.
그 부분은 글 올리기 전에 알려주신것처럼 해 보았는데 되지 않았습니다.
관심 감사합니다
그 부분은 글 올리기 전에 알려주신것처럼 해 보았는데 되지 않았습니다.
관심 감사합니다
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_w = "310"; //썸네일 가로
$img_h = "80"; //썸네일 세로
$img_quality = "100"; //압축화질
$data_path = $g4[path]."/data/file/$bo_table/";
$thumb_path = $data_path."/thumb_2";
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<? for ($i=0; $i<count($list); $i++) { ?>
<?
//썸네일 코드 시작
$image = $list[$i][file][0][file];
$image = $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
continue;
$rate = $img_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $img_h)
$dst = imagecreatetruecolor($img_w, $height);
else
$dst = imagecreatetruecolor($img_w, $img_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$image = $thumb;
?>
<? } ?>
테스트해보고 썸네일 생성 부분만 올립니다.
썸네일이 있을경우 썸네일 출력
없으면 원본출력합니다.
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_w = "310"; //썸네일 가로
$img_h = "80"; //썸네일 세로
$img_quality = "100"; //압축화질
$data_path = $g4[path]."/data/file/$bo_table/";
$thumb_path = $data_path."/thumb_2";
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<? for ($i=0; $i<count($list); $i++) { ?>
<?
//썸네일 코드 시작
$image = $list[$i][file][0][file];
$image = $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
continue;
$rate = $img_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $img_h)
$dst = imagecreatetruecolor($img_w, $height);
else
$dst = imagecreatetruecolor($img_w, $img_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$image = $thumb;
?>
<? } ?>
테스트해보고 썸네일 생성 부분만 올립니다.
썸네일이 있을경우 썸네일 출력
없으면 원본출력합니다.
모바일님
잘 됩니다.~!
감사드립니다. 크리스마스 선물중에 최고네요.
허접하지만 스킨 만들어서 올려보겠습니다.
감사합니다.
잘 됩니다.~!
감사드립니다. 크리스마스 선물중에 최고네요.
허접하지만 스킨 만들어서 올려보겠습니다.
감사합니다.
이미지 썸네일로 출력하기 ^^