고수님들 !!!! 저의 글중 문법적용이 잘못된 부분좀 지적해주세요.... 정보
고수님들 !!!! 저의 글중 문법적용이 잘못된 부분좀 지적해주세요....본문
저의 의도는
http://yemam.org/bbs/board.php?bo_table=pastor_4&wr_id=9&page=0&sca=&sfl=&stx=&spt=0&page=0&cwin=#c_10
처럼 리스트에서도 똑같이 보여지도록 html게시판을 만들고자 합니다.
하지만 http://yemam.org/bbs/board.php?bo_table=pastor_1 상태에 머물고 있습니다.
아래가 리스트에서 썸을 만들고, 글과 함께 보여주는 부분입니다.
이중에서 문법이 잘못된 곳을 지적해주시기 바랍니다.
-----------------------------
<?
for ($i=0; $i<count($list); $i++) {
if ($i == 0 && $is_category) {
echo "<table width=100% border=0 cellpadding=0 cellspacing=0 style='border-top:0px solid #D1D1D1; border-right:1px solid #D1D1D1;border-bottom:1px solid #D1D1D1;border-left:1px solid #D1D1D1;clear:both; height:50px;padding:25px;'><tr><td >";
}
else {
echo "<table width=100% border=0 cellpadding=0 cellspacing=0 style='border-top:1px solid #D1D1D1; border-right:1px solid #D1D1D1;border-bottom:1px solid #D1D1D1;border-left:1px solid #D1D1D1;clear:both; height:50px;padding:25px;'><tr><td >";
}
echo "<p align='center'><font size='3'><b>{$list[$i][subject]}</b></font></p>";
if (is_array($list[$i]['file'])) {// 파일중 정확히 이미지 인것만 배열에 담음
$img_array = Array();
$m = 1;
foreach($list[$i]['file'] as $k => $v){
$path_image_file = $data_path . '/' . $v['file'];
if (!empty($v['file']) && preg_match("/\.(jp[e]?g|gif|png)$/i", $v['file']) && is_file($path_image_file)) {//값이 있고, 이미지 확장자이며, 존재하는지 체크
//완전한 이미지 인지 한번더 체크
list($src_w, $src_h, $src_type) = @getimagesize($path_image_file);
//원본의 너비가 썸네일의 너비보다 크거나 같고, 원본의 높이가 썸네일의 높이보다 크거나 같고 지원하는 이미지 타입일때만 썸네일 생성
if ($src_w >= $thumb_w && $src_h >= $thumb_h && ($src_type == 1 || $src_type == 2 || $src_type == 3)) {
$j = ($m % 8); // 8 = 최대 사용하고자 하는 그림수(7) + 1 // 이 스킨은 7개까지 수용, 확장도 가능
$f = $j + 10 ;
$r = $j + 20 ;
$w = $j + 30 ;
$h = $j + 40 ;
$options = Array();//옵션설정, 공통적인 것이므로 한번만 하면됨
list($thumb_pos, $watermark_pos) = explode('/', $list[$i]['wr_' . $r]);
if ($thumb_pos =='1'){//너비 기준은 좌, 높이 기준은 상단 크롭
$options['crop_pos_width'] = 1; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 1; // 1 상, 2 중, 3 하
}
if ($thumb_pos =='2'){//너비 기준은 가운데, 높이 기준은 중앙 크롭
$options['crop_pos_width'] = 2; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 2; // 1 상, 2 중, 3 하
}
if ($thumb_pos =='3'){//너비 기준은 우, 높이 기준은 하단 크롭
$options['crop_pos_width'] = 3; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 3; // 1 상, 2 중, 3 하
}
$mark_file ="$g4[path]/img/watermark_100_2.png";//워터마크에 사용할 파일
if ($watermark_pos == 'x'){//워타마크를 생성하지 않음
$mark_file = '';
}
$options['watermark_path_file'] = $mark_file;//워터마크 이미지
$options['watermark_sharpness'] = 100;
$options['watermark_pos'] = $watermark_pos;
$thumb_w = $list[$i]['wr_' . $w] ;
$thumb_h = $list[$i]['wr_' . $h] ;
$float_style = $list[$i]['wr_' . $f] ;
$thumb = $thumb_path . '/' . 'U3P2_N_' . $thumb_pos . '_' . $watermark_pos . '_' . $thumb_w . 'X' . $thumb_h . '_' . $v['file'] ;
if (!is_file($thumb)) {
$result_save = thumnail_test1($path_image_file, $thumb, $thumb_w, $thumb_h, $options);
}
if (is_file($thumb)) {
$img_array[] = Array('src'=>$path_image_file, 'thumb'=>$thumb, 'float_style'=>$float_style);
$i++;
}
}
}
}
}
if (count($img_array) > 0){
$web_zine_content = explode('//##', $list[$i]['content']); //그림의 위치와 본문이 나뉘는 위치
$web_zine_content = str_replace("//##", " ", $web_zine_content);
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[0]</div>"; // 그림보다 위에 있는 본문
$web_zine_content_cnt = count($web_zine_content);
for($m = 0; $m < $web_zine_content_cnt - 1; $m++) {
if (!empty($img_array['float_style'])) {
$j = $m + 1 ;
if ($is_admin == "super") {
if ($img_array['float_style'] == 'left') {
echo "<span style='float:" . $img_array['float_style'] . "' style='padding:10 10 10 0;'>
<a href='javascript:openImageWinCenter(\"" . $img_array['src'] . "\")'>
<img src='" . $img_array['thumb'] . "' style='border:1 solid #755B0D;'></a>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
else {
echo "<span style='float:" . $img_array['float_style'] . "' style='padding:10 0 10 10;'>
<a href='javascript:openImageWinCenter(\"" . $img_array['src'] . "\")'>
<img src='" . $img_array['thumb'] . "' style='border:1 solid #755B0D;'></a>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
else {
if ($img_array['float_style'] == "left") {
echo "<span style='float:" . $img_array['float_style'] . "' style='padding:10 10 10 0;'>
<img src='" . $img_array['thumb'] . "' style='border:1 solid #755B0D;'>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
else {
echo "<span style='float:" . $img_array['float_style'] . "' style='padding:10 0 10 10;'>
<img src='" . $img_array['thumb'] . "' style='border:1 solid #755B0D;'>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
}
else {
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
}
else {
$web_zine_content = explode('//##', $list[$i]['content']); //그림의 위치와 본문이 나뉘는 위치
$web_zine_content = str_replace("//##", " ", $web_zine_content);
echo "<div align='justify' style='margin-right:1; margin-left:1;'><font color='$dq_board_5'>$list_contents</font></div>";
}
if (count($list) == 0) { echo "<table><tr><td align=center>자료가 없습니다.</td></tr></table>"; }
echo " </td></tr></table>";
?>
<? if ($admin_href) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" >
<a href="<?=$list[$i][href]?>"><img src="<?=$board_skin_path?>/img/btn_modify.gif" border=0></a>
</td>
<td>
<!-- 버튼 링크 -->
<form name=fsearch method=get style="margin:0px;">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=sca value="<?=$sca?>">
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td width="50%" height="40">
<a href="<?=$write_href?>"><img src="<?=$board_skin_path?>/img/btn_write.gif" border="0"></a>
</td><td align="right">
<span style="color:#888888; font-weight:bold;">Total <?=number_format($total_count)?></span>
<a href="<?=$admin_href?>"><a href=<?=$_SERVER['PHP_SELF']?>?delete_smallimg=1&<?=$_SERVER['QUERY_STRING']?>>썸네일삭제</a>
<a href="<?=$admin_href?>"><img src="<?=$board_skin_path?>/img/btn_admin.gif" title="관리자" border="0" align="absmiddle"></a>
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr><td height='7'></td></tr>
</table>
<?} else {?>
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td height='10'></td></tr></table>
<? }?>
<?}?>
</td></tr></table>
---------------------
고수님들의 답변을 받은 후 어느분에게 점수를 드려야될지 선택하는 것이 참 어렵더군요.
똑같은 대답이면서도 점수받지 못하시게되도 양해부탁드립니다.
http://yemam.org/bbs/board.php?bo_table=pastor_4&wr_id=9&page=0&sca=&sfl=&stx=&spt=0&page=0&cwin=#c_10
처럼 리스트에서도 똑같이 보여지도록 html게시판을 만들고자 합니다.
하지만 http://yemam.org/bbs/board.php?bo_table=pastor_1 상태에 머물고 있습니다.
아래가 리스트에서 썸을 만들고, 글과 함께 보여주는 부분입니다.
이중에서 문법이 잘못된 곳을 지적해주시기 바랍니다.
-----------------------------
<?
for ($i=0; $i<count($list); $i++) {
if ($i == 0 && $is_category) {
echo "<table width=100% border=0 cellpadding=0 cellspacing=0 style='border-top:0px solid #D1D1D1; border-right:1px solid #D1D1D1;border-bottom:1px solid #D1D1D1;border-left:1px solid #D1D1D1;clear:both; height:50px;padding:25px;'><tr><td >";
}
else {
echo "<table width=100% border=0 cellpadding=0 cellspacing=0 style='border-top:1px solid #D1D1D1; border-right:1px solid #D1D1D1;border-bottom:1px solid #D1D1D1;border-left:1px solid #D1D1D1;clear:both; height:50px;padding:25px;'><tr><td >";
}
echo "<p align='center'><font size='3'><b>{$list[$i][subject]}</b></font></p>";
if (is_array($list[$i]['file'])) {// 파일중 정확히 이미지 인것만 배열에 담음
$img_array = Array();
$m = 1;
foreach($list[$i]['file'] as $k => $v){
$path_image_file = $data_path . '/' . $v['file'];
if (!empty($v['file']) && preg_match("/\.(jp[e]?g|gif|png)$/i", $v['file']) && is_file($path_image_file)) {//값이 있고, 이미지 확장자이며, 존재하는지 체크
//완전한 이미지 인지 한번더 체크
list($src_w, $src_h, $src_type) = @getimagesize($path_image_file);
//원본의 너비가 썸네일의 너비보다 크거나 같고, 원본의 높이가 썸네일의 높이보다 크거나 같고 지원하는 이미지 타입일때만 썸네일 생성
if ($src_w >= $thumb_w && $src_h >= $thumb_h && ($src_type == 1 || $src_type == 2 || $src_type == 3)) {
$j = ($m % 8); // 8 = 최대 사용하고자 하는 그림수(7) + 1 // 이 스킨은 7개까지 수용, 확장도 가능
$f = $j + 10 ;
$r = $j + 20 ;
$w = $j + 30 ;
$h = $j + 40 ;
$options = Array();//옵션설정, 공통적인 것이므로 한번만 하면됨
list($thumb_pos, $watermark_pos) = explode('/', $list[$i]['wr_' . $r]);
if ($thumb_pos =='1'){//너비 기준은 좌, 높이 기준은 상단 크롭
$options['crop_pos_width'] = 1; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 1; // 1 상, 2 중, 3 하
}
if ($thumb_pos =='2'){//너비 기준은 가운데, 높이 기준은 중앙 크롭
$options['crop_pos_width'] = 2; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 2; // 1 상, 2 중, 3 하
}
if ($thumb_pos =='3'){//너비 기준은 우, 높이 기준은 하단 크롭
$options['crop_pos_width'] = 3; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 3; // 1 상, 2 중, 3 하
}
$mark_file ="$g4[path]/img/watermark_100_2.png";//워터마크에 사용할 파일
if ($watermark_pos == 'x'){//워타마크를 생성하지 않음
$mark_file = '';
}
$options['watermark_path_file'] = $mark_file;//워터마크 이미지
$options['watermark_sharpness'] = 100;
$options['watermark_pos'] = $watermark_pos;
$thumb_w = $list[$i]['wr_' . $w] ;
$thumb_h = $list[$i]['wr_' . $h] ;
$float_style = $list[$i]['wr_' . $f] ;
$thumb = $thumb_path . '/' . 'U3P2_N_' . $thumb_pos . '_' . $watermark_pos . '_' . $thumb_w . 'X' . $thumb_h . '_' . $v['file'] ;
if (!is_file($thumb)) {
$result_save = thumnail_test1($path_image_file, $thumb, $thumb_w, $thumb_h, $options);
}
if (is_file($thumb)) {
$img_array[] = Array('src'=>$path_image_file, 'thumb'=>$thumb, 'float_style'=>$float_style);
$i++;
}
}
}
}
}
if (count($img_array) > 0){
$web_zine_content = explode('//##', $list[$i]['content']); //그림의 위치와 본문이 나뉘는 위치
$web_zine_content = str_replace("//##", " ", $web_zine_content);
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[0]</div>"; // 그림보다 위에 있는 본문
$web_zine_content_cnt = count($web_zine_content);
for($m = 0; $m < $web_zine_content_cnt - 1; $m++) {
if (!empty($img_array['float_style'])) {
$j = $m + 1 ;
if ($is_admin == "super") {
if ($img_array['float_style'] == 'left') {
echo "<span style='float:" . $img_array['float_style'] . "' style='padding:10 10 10 0;'>
<a href='javascript:openImageWinCenter(\"" . $img_array['src'] . "\")'>
<img src='" . $img_array['thumb'] . "' style='border:1 solid #755B0D;'></a>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
else {
echo "<span style='float:" . $img_array['float_style'] . "' style='padding:10 0 10 10;'>
<a href='javascript:openImageWinCenter(\"" . $img_array['src'] . "\")'>
<img src='" . $img_array['thumb'] . "' style='border:1 solid #755B0D;'></a>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
else {
if ($img_array['float_style'] == "left") {
echo "<span style='float:" . $img_array['float_style'] . "' style='padding:10 10 10 0;'>
<img src='" . $img_array['thumb'] . "' style='border:1 solid #755B0D;'>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
else {
echo "<span style='float:" . $img_array['float_style'] . "' style='padding:10 0 10 10;'>
<img src='" . $img_array['thumb'] . "' style='border:1 solid #755B0D;'>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
}
else {
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
}
else {
$web_zine_content = explode('//##', $list[$i]['content']); //그림의 위치와 본문이 나뉘는 위치
$web_zine_content = str_replace("//##", " ", $web_zine_content);
echo "<div align='justify' style='margin-right:1; margin-left:1;'><font color='$dq_board_5'>$list_contents</font></div>";
}
if (count($list) == 0) { echo "<table><tr><td align=center>자료가 없습니다.</td></tr></table>"; }
echo " </td></tr></table>";
?>
<? if ($admin_href) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" >
<a href="<?=$list[$i][href]?>"><img src="<?=$board_skin_path?>/img/btn_modify.gif" border=0></a>
</td>
<td>
<!-- 버튼 링크 -->
<form name=fsearch method=get style="margin:0px;">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=sca value="<?=$sca?>">
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td width="50%" height="40">
<a href="<?=$write_href?>"><img src="<?=$board_skin_path?>/img/btn_write.gif" border="0"></a>
</td><td align="right">
<span style="color:#888888; font-weight:bold;">Total <?=number_format($total_count)?></span>
<a href="<?=$admin_href?>"><a href=<?=$_SERVER['PHP_SELF']?>?delete_smallimg=1&<?=$_SERVER['QUERY_STRING']?>>썸네일삭제</a>
<a href="<?=$admin_href?>"><img src="<?=$board_skin_path?>/img/btn_admin.gif" title="관리자" border="0" align="absmiddle"></a>
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr><td height='7'></td></tr>
</table>
<?} else {?>
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td height='10'></td></tr></table>
<? }?>
<?}?>
</td></tr></table>
---------------------
고수님들의 답변을 받은 후 어느분에게 점수를 드려야될지 선택하는 것이 참 어렵더군요.
똑같은 대답이면서도 점수받지 못하시게되도 양해부탁드립니다.
댓글 전체
뷰화면소스는 아래입니다.
-----------------------------
<table border=0 cellpadding=0 cellspacing=0 width="100%">
<tr><td style='padding:20;border:1 solid #D1D1D1;'>
<?
if (is_array($view['file'])) {// 파일중 정확히 이미지 인것만 배열에 담음
$img_array = Array();
$i = 1;
foreach($view['file'] as $k => $v){
$path_image_file = $data_path . '/' . $v['file'];
if (!empty($v['file']) && preg_match("/\.(jp[e]?g|gif|png)$/i", $v['file']) && is_file($path_image_file)) {//값이 있고, 이미지 확장자이며, 존재하는지 체크
//완전한 이미지 인지 한번더 체크
list($src_w, $src_h, $src_type) = @getimagesize($path_image_file);
//원본의 너비가 썸네일의 너비보다 크거나 같고, 원본의 높이가 썸네일의 높이보다 크거나 같고 지원하는 이미지 타입일때만 썸네일 생성
if ($src_w >= $thumb_w && $src_h >= $thumb_h && ($src_type == 1 || $src_type == 2 || $src_type == 3)) {
$j = ($i % 8); // 8 = 최대 사용하고자 하는 그림수(7) + 1 // 이 스킨은 7개까지 수용, 확장도 가능
$f = $j + 10 ;
$r = $j + 20 ;
$w = $j + 30 ;
$h = $j + 40 ;
$options = Array();//옵션설정, 공통적인 것이므로 한번만 하면됨
list($thumb_pos, $watermark_pos) = explode('/', $view['wr_' . $r]);
if ($thumb_pos =='1'){//너비 기준은 좌, 높이 기준은 상단 크롭
$options['crop_pos_width'] = 1; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 1; // 1 상, 2 중, 3 하
}
if ($thumb_pos =='2'){//너비 기준은 가운데, 높이 기준은 중앙 크롭
$options['crop_pos_width'] = 2; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 2; // 1 상, 2 중, 3 하
}
if ($thumb_pos =='3'){//너비 기준은 우, 높이 기준은 하단 크롭
$options['crop_pos_width'] = 3; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 3; // 1 상, 2 중, 3 하
}
$mark_file ="$g4[path]/img/watermark_100_2.png";//워터마크에 사용할 파일
if ($watermark_pos == 'x'){//워타마크를 생성하지 않음
$mark_file = '';
}
$options['watermark_path_file'] = $mark_file;//워터마크 이미지
$options['watermark_sharpness'] = 100;
$options['watermark_pos'] = $watermark_pos;
$thumb_w = $view['wr_' . $w] ;
$thumb_h = $view['wr_' . $h] ;
$float_style = $view['wr_' . $f] ;
$thumb = $thumb_path . '/' . 'U3P2_N_' . $thumb_pos . '_' . $watermark_pos . '_' . $thumb_w . 'X' . $thumb_h . '_' . $v['file'] ;
if (!is_file($thumb)) {
$result_save = thumnail_test1($path_image_file, $thumb, $thumb_w, $thumb_h, $options);
}
if (is_file($thumb)) {
$img_array[] = Array('src'=>$path_image_file, 'thumb'=>$thumb, 'float_style'=>$float_style);
$i++;
}
}
}
}
}
if (count($img_array) > 0){
$web_zine_content = explode('//##', $view['content']); //그림의 위치와 본문이 나뉘는 위치
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[0]</div>"; // 그림보다 위에 있는 본문
$web_zine_content_cnt = count($web_zine_content);
for($i = 0; $i < $web_zine_content_cnt - 1; $i++) {
if (!empty($img_array[$i]['float_style'])) {
$j = $i + 1 ;
if ($is_admin == "super") {
if ($img_array[$i]['float_style'] == 'left') {
echo "<span style='float:" . $img_array[$i]['float_style'] . "' style='padding:10 10 10 0;'>
<a href='javascript:openImageWinCenter(\"" . $img_array[$i]['src'] . "\")'>
<img src='" . $img_array[$i]['thumb'] . "' style='border:1 solid #755B0D;'></a>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
else {
echo "<span style='float:" . $img_array[$i]['float_style'] . "' style='padding:10 0 10 10;'>
<a href='javascript:openImageWinCenter(\"" . $img_array[$i]['src'] . "\")'>
<img src='" . $img_array[$i]['thumb'] . "' style='border:1 solid #755B0D;'></a>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
else {
if ($img_array[$i]['float_style'] == "left") {
echo "<span style='float:" . $img_array[$i]['float_style'] . "' style='padding:10 10 10 0;'>
<img src='" . $img_array[$i]['thumb'] . "' style='border:1 solid #755B0D;'>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
else {
echo "<span style='float:" . $img_array[$i]['float_style'] . "' style='padding:10 0 10 10;'>
<img src='" . $img_array[$i]['thumb'] . "' style='border:1 solid #755B0D;'>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
}
else {
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
}
else {
$view['content'] = str_replace('//##', '', $view['content']);
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>" . $view['content'] . "</div>";
}
if ($is_signature) { echo "<div style='padding:20 0 10 0;line-height:15px;'><font color='#C5BDA0'>$signature</font></div>"; } // 서명 출력
?>
</td></tr></table><br>
-----------------------------
<table border=0 cellpadding=0 cellspacing=0 width="100%">
<tr><td style='padding:20;border:1 solid #D1D1D1;'>
<?
if (is_array($view['file'])) {// 파일중 정확히 이미지 인것만 배열에 담음
$img_array = Array();
$i = 1;
foreach($view['file'] as $k => $v){
$path_image_file = $data_path . '/' . $v['file'];
if (!empty($v['file']) && preg_match("/\.(jp[e]?g|gif|png)$/i", $v['file']) && is_file($path_image_file)) {//값이 있고, 이미지 확장자이며, 존재하는지 체크
//완전한 이미지 인지 한번더 체크
list($src_w, $src_h, $src_type) = @getimagesize($path_image_file);
//원본의 너비가 썸네일의 너비보다 크거나 같고, 원본의 높이가 썸네일의 높이보다 크거나 같고 지원하는 이미지 타입일때만 썸네일 생성
if ($src_w >= $thumb_w && $src_h >= $thumb_h && ($src_type == 1 || $src_type == 2 || $src_type == 3)) {
$j = ($i % 8); // 8 = 최대 사용하고자 하는 그림수(7) + 1 // 이 스킨은 7개까지 수용, 확장도 가능
$f = $j + 10 ;
$r = $j + 20 ;
$w = $j + 30 ;
$h = $j + 40 ;
$options = Array();//옵션설정, 공통적인 것이므로 한번만 하면됨
list($thumb_pos, $watermark_pos) = explode('/', $view['wr_' . $r]);
if ($thumb_pos =='1'){//너비 기준은 좌, 높이 기준은 상단 크롭
$options['crop_pos_width'] = 1; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 1; // 1 상, 2 중, 3 하
}
if ($thumb_pos =='2'){//너비 기준은 가운데, 높이 기준은 중앙 크롭
$options['crop_pos_width'] = 2; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 2; // 1 상, 2 중, 3 하
}
if ($thumb_pos =='3'){//너비 기준은 우, 높이 기준은 하단 크롭
$options['crop_pos_width'] = 3; // 1 좌, 2 가운데, 3 우
$options['crop_pos_height'] = 3; // 1 상, 2 중, 3 하
}
$mark_file ="$g4[path]/img/watermark_100_2.png";//워터마크에 사용할 파일
if ($watermark_pos == 'x'){//워타마크를 생성하지 않음
$mark_file = '';
}
$options['watermark_path_file'] = $mark_file;//워터마크 이미지
$options['watermark_sharpness'] = 100;
$options['watermark_pos'] = $watermark_pos;
$thumb_w = $view['wr_' . $w] ;
$thumb_h = $view['wr_' . $h] ;
$float_style = $view['wr_' . $f] ;
$thumb = $thumb_path . '/' . 'U3P2_N_' . $thumb_pos . '_' . $watermark_pos . '_' . $thumb_w . 'X' . $thumb_h . '_' . $v['file'] ;
if (!is_file($thumb)) {
$result_save = thumnail_test1($path_image_file, $thumb, $thumb_w, $thumb_h, $options);
}
if (is_file($thumb)) {
$img_array[] = Array('src'=>$path_image_file, 'thumb'=>$thumb, 'float_style'=>$float_style);
$i++;
}
}
}
}
}
if (count($img_array) > 0){
$web_zine_content = explode('//##', $view['content']); //그림의 위치와 본문이 나뉘는 위치
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[0]</div>"; // 그림보다 위에 있는 본문
$web_zine_content_cnt = count($web_zine_content);
for($i = 0; $i < $web_zine_content_cnt - 1; $i++) {
if (!empty($img_array[$i]['float_style'])) {
$j = $i + 1 ;
if ($is_admin == "super") {
if ($img_array[$i]['float_style'] == 'left') {
echo "<span style='float:" . $img_array[$i]['float_style'] . "' style='padding:10 10 10 0;'>
<a href='javascript:openImageWinCenter(\"" . $img_array[$i]['src'] . "\")'>
<img src='" . $img_array[$i]['thumb'] . "' style='border:1 solid #755B0D;'></a>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
else {
echo "<span style='float:" . $img_array[$i]['float_style'] . "' style='padding:10 0 10 10;'>
<a href='javascript:openImageWinCenter(\"" . $img_array[$i]['src'] . "\")'>
<img src='" . $img_array[$i]['thumb'] . "' style='border:1 solid #755B0D;'></a>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
else {
if ($img_array[$i]['float_style'] == "left") {
echo "<span style='float:" . $img_array[$i]['float_style'] . "' style='padding:10 10 10 0;'>
<img src='" . $img_array[$i]['thumb'] . "' style='border:1 solid #755B0D;'>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
else {
echo "<span style='float:" . $img_array[$i]['float_style'] . "' style='padding:10 0 10 10;'>
<img src='" . $img_array[$i]['thumb'] . "' style='border:1 solid #755B0D;'>
</span>";
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
}
else {
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>$web_zine_content[$j]</div>";
}
}
}
else {
$view['content'] = str_replace('//##', '', $view['content']);
echo "<div align='justify' style='margin-right:1; margin-left:1;line-height:150%;'>" . $view['content'] . "</div>";
}
if ($is_signature) { echo "<div style='padding:20 0 10 0;line-height:15px;'><font color='#C5BDA0'>$signature</font></div>"; } // 서명 출력
?>
</td></tr></table><br>
문법이 틀린게 있으려나요. 잘 작동되면 이상이 없다는건데... 구지 따지자면 그누보드 자체도 표준문법이아닌 편법도 많이 써서... 근데 nested if 문이 너무 많아서 코드 읽는데 머리가 아픕니다. 잘 작동된다면 괜찮지만, } 하나 실수로 빼먹어서 오류나면 정말 머리아프겠어요. 일관성과 효율성을 따져 코드 가독성을 높이는 방식으로 코딩하시면 좋을것 같습니다.
http://yemam.org/bbs/board.php?bo_table=pastor_1
처럼 지금 작동하지 않습니다.
다시한번 }를 유심히 살펴보겠습니다.
}의 위치에 따라서도 결과가 엄청난 차이가 나던데...
혹시 보시고 잘못된 위치 확인해주실 수 있어요?
처럼 지금 작동하지 않습니다.
다시한번 }를 유심히 살펴보겠습니다.
}의 위치에 따라서도 결과가 엄청난 차이가 나던데...
혹시 보시고 잘못된 위치 확인해주실 수 있어요?
하수들에게는 단순화가 쉬운일이 아니더군요....
아래는 쉽게 보실 수 있으리라 생각됩니다.
아래를 보시고 지적해주시기 부탁드립니다.
list($thumb_pos, $watermark_pos) = explode('/', $list[$i]['wr_' . $r]);
에서 $list[$i]['wr_' . $r] 을 더 나누었습니다.
아래처럼 했어요.
list($thumb_pos[$f], $watermark_pos[$f]) = explode('/', $list[$i]['wr_' . $r][$f]['wr_' . $r]);
제대로 작성한 것인가요? 지금 요부분이 작동되지 않습니다.
그리고 아래를 더 단순화할 수는 없는가요?
----------------------------------------------
$options[$f] = Array();//옵션설정, 공통적인 것이므로 한번만 하면됨
list($thumb_pos[$f], $watermark_pos[$f]) = explode('/', $list[$i]['wr_' . $r][$f]['wr_' . $r]);
if ($thumb_pos[$f] =='1'){//너비 기준은 좌, 높이 기준은 상단 크롭
$options[$f]['crop_pos_width'] = 1; // 1 좌, 2 가운데, 3 우
$options[$f]['crop_pos_height'] = 1; // 1 상, 2 중, 3 하
}
if ($thumb_pos[$f] =='2'){//너비 기준은 가운데, 높이 기준은 중앙 크롭
$options[$f]['crop_pos_width'] = 2; // 1 좌, 2 가운데, 3 우
$options[$f]['crop_pos_height'] = 2; // 1 상, 2 중, 3 하
}
if ($thumb_pos[$f] =='3'){//너비 기준은 우, 높이 기준은 하단 크롭
$options[$f]['crop_pos_width'] = 3; // 1 좌, 2 가운데, 3 우
$options[$f]['crop_pos_height'] = 3; // 1 상, 2 중, 3 하
}
$mark_file ="$g4[path]/img/watermark_100_2.png";//워터마크에 사용할 파일
if ($watermark_pos[$f] == 'x'){//워타마크를 생성하지 않음
$mark_file = '';
}
$options[$f]['watermark_path_file'] = $mark_file;//워터마크 이미지
$options[$f]['watermark_sharpness'] = 100;
$options[$f]['watermark_pos'] = $watermark_pos[$f];
아래는 쉽게 보실 수 있으리라 생각됩니다.
아래를 보시고 지적해주시기 부탁드립니다.
list($thumb_pos, $watermark_pos) = explode('/', $list[$i]['wr_' . $r]);
에서 $list[$i]['wr_' . $r] 을 더 나누었습니다.
아래처럼 했어요.
list($thumb_pos[$f], $watermark_pos[$f]) = explode('/', $list[$i]['wr_' . $r][$f]['wr_' . $r]);
제대로 작성한 것인가요? 지금 요부분이 작동되지 않습니다.
그리고 아래를 더 단순화할 수는 없는가요?
----------------------------------------------
$options[$f] = Array();//옵션설정, 공통적인 것이므로 한번만 하면됨
list($thumb_pos[$f], $watermark_pos[$f]) = explode('/', $list[$i]['wr_' . $r][$f]['wr_' . $r]);
if ($thumb_pos[$f] =='1'){//너비 기준은 좌, 높이 기준은 상단 크롭
$options[$f]['crop_pos_width'] = 1; // 1 좌, 2 가운데, 3 우
$options[$f]['crop_pos_height'] = 1; // 1 상, 2 중, 3 하
}
if ($thumb_pos[$f] =='2'){//너비 기준은 가운데, 높이 기준은 중앙 크롭
$options[$f]['crop_pos_width'] = 2; // 1 좌, 2 가운데, 3 우
$options[$f]['crop_pos_height'] = 2; // 1 상, 2 중, 3 하
}
if ($thumb_pos[$f] =='3'){//너비 기준은 우, 높이 기준은 하단 크롭
$options[$f]['crop_pos_width'] = 3; // 1 좌, 2 가운데, 3 우
$options[$f]['crop_pos_height'] = 3; // 1 상, 2 중, 3 하
}
$mark_file ="$g4[path]/img/watermark_100_2.png";//워터마크에 사용할 파일
if ($watermark_pos[$f] == 'x'){//워타마크를 생성하지 않음
$mark_file = '';
}
$options[$f]['watermark_path_file'] = $mark_file;//워터마크 이미지
$options[$f]['watermark_sharpness'] = 100;
$options[$f]['watermark_pos'] = $watermark_pos[$f];
아참, 혹시 html 문법을 말씀하신거면
http://validator.w3.org/check?uri=http://yemam.org/bbs/board.php%3Fbo_table%3Dpastor_1&charset=euc-kr&doctype=Inline&group=0
http://validator.w3.org/check?uri=http://yemam.org/bbs/board.php%3Fbo_table%3Dpastor_4%26wr_id%3D9%26page%3D0%26sca%3D%26sfl%3D%26stx%3D%26spt%3D0%26page%3D0%26cwin%3D%23c_10&charset=euc-kr&doctype=Inline&group=0&user-agent=W3C_Validator/1.2
여기를 참조하시면 좋을듯 싶어요.
http://validator.w3.org/check?uri=http://yemam.org/bbs/board.php%3Fbo_table%3Dpastor_1&charset=euc-kr&doctype=Inline&group=0
http://validator.w3.org/check?uri=http://yemam.org/bbs/board.php%3Fbo_table%3Dpastor_4%26wr_id%3D9%26page%3D0%26sca%3D%26sfl%3D%26stx%3D%26spt%3D0%26page%3D0%26cwin%3D%23c_10&charset=euc-kr&doctype=Inline&group=0&user-agent=W3C_Validator/1.2
여기를 참조하시면 좋을듯 싶어요.