첨부 이미지 출력 관련입니다. 정보
그누보드 첨부 이미지 출력 관련입니다.관련링크
본문
안녕하세요..
폭설로 걱정이 많았는데 오늘 날씨가 너무 따뜻하여 한시름이 놓입니다. ^^;
다름이 아니오라 게시물 보기에서 첨부 이미지 출력부분을 만지고 있는데 잘 되지 않아 이렇게 자문을 구합니다.
수정 전 소스에서 수정 후로 변경하였더니 첨부이미지 출력이 되지 않고 있는데 무엇이 잘못된 건지 잘 모르겠습니다. 고수님들의 가르침을 기다리며 이만 줄입니다.
수정 전 소스
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
수정 후 소스
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo "<table align=right width= cellpadding=0 cellspacing=0 STYLE='margin-left:10px'><tr><td> $file[$i][view] </td></tr></table>"; }
}
?>
폭설로 걱정이 많았는데 오늘 날씨가 너무 따뜻하여 한시름이 놓입니다. ^^;
다름이 아니오라 게시물 보기에서 첨부 이미지 출력부분을 만지고 있는데 잘 되지 않아 이렇게 자문을 구합니다.
수정 전 소스에서 수정 후로 변경하였더니 첨부이미지 출력이 되지 않고 있는데 무엇이 잘못된 건지 잘 모르겠습니다. 고수님들의 가르침을 기다리며 이만 줄입니다.
수정 전 소스
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
수정 후 소스
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo "<table align=right width= cellpadding=0 cellspacing=0 STYLE='margin-left:10px'><tr><td> $file[$i][view] </td></tr></table>"; }
}
?>
댓글 전체
최종적으로 아래와 같이 수정하였습니다. ^^;
참고로 첨부된 이미지의 넓이가 350 이상일때 350으로 고정하려고 하였는데 해결하지 못하였습니다.
또 첨부된 사진의 설명문을 넣으려고도 했지만 잘 되지 않아 주석처리만 하였습니다.
고수님께서 손봐 주시면 감사하겠습니다. ^^;
최종적으로 아래와 같이 수정하였습니다. ^^;
<?
echo "<table border=0 cellpadding=0 cellspacing=0 align=left style='margin-right:10px'>";
for ($i=1; $i<=$cfg[file_count]; $i++) {
$file[$i][source] = $file[$i][aview] = "";
$wr_file = $write["wr_file".$i];
if ($wr_file) {
$size = getimagesize("./data/file/$bo_table/$wr_file");
$file[$i]->source_width = $size[0];
$file[$i]->source_height = $size[1];
$max_width = 350; // width 제한 크기
// $max_height = 85; // height 제한 크기
if($size[0] > $max_width) {
$ratio = $max_width / $size[0]; // 게시판 width에 대한 그림파일의 width 비율 계산.
$img_width = $size[0] * $ratio; // 그림파일의 width와 height에 동일 ratio 적용.
$img_height = $size[1] * $ratio;
$file[$i][aview] = "<tr><td width=$img_width>".view_file_link($write["wr_file".$i])."</td></tr>";
} else {
$img_width = $size[0]; // 지정된 크기보다 작을경우 원사이즈대로 출력
$img_height = $size[1];
$file[$i][aview] = "<tr><td width=$img_width>".view_file_link($write["wr_file".$i])."</td></tr>";
}
}
}
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][aview]) { echo $file[$i][aview]; }
}
echo "</table>";
?>
<!--
<table align=left width= cellpadding=0 cellspacing=0 STYLE='margin-right:10px'><tr><td>
<?
for ($i=1; $i<=1; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
<? if ($write[wr_1]) { echo "<center><font color=cf4900>$write[wr_1]</font></center>"; } ?> <?// 사진설명?>
</td></tr><tr><td>
<?
for ($i=2; $i<=2; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
<? if ($write[wr_2]) { echo "<center><font color=cf4900>$write[wr_2]</font></center>"; } ?> <?// 사진설명?>
</td></tr></table>
-->
참고로 첨부된 이미지의 넓이가 350 이상일때 350으로 고정하려고 하였는데 해결하지 못하였습니다.
또 첨부된 사진의 설명문을 넣으려고도 했지만 잘 되지 않아 주석처리만 하였습니다.
고수님께서 손봐 주시면 감사하겠습니다. ^^;
최종적으로 아래와 같이 수정하였습니다. ^^;
<?
echo "<table border=0 cellpadding=0 cellspacing=0 align=left style='margin-right:10px'>";
for ($i=1; $i<=$cfg[file_count]; $i++) {
$file[$i][source] = $file[$i][aview] = "";
$wr_file = $write["wr_file".$i];
if ($wr_file) {
$size = getimagesize("./data/file/$bo_table/$wr_file");
$file[$i]->source_width = $size[0];
$file[$i]->source_height = $size[1];
$max_width = 350; // width 제한 크기
// $max_height = 85; // height 제한 크기
if($size[0] > $max_width) {
$ratio = $max_width / $size[0]; // 게시판 width에 대한 그림파일의 width 비율 계산.
$img_width = $size[0] * $ratio; // 그림파일의 width와 height에 동일 ratio 적용.
$img_height = $size[1] * $ratio;
$file[$i][aview] = "<tr><td width=$img_width>".view_file_link($write["wr_file".$i])."</td></tr>";
} else {
$img_width = $size[0]; // 지정된 크기보다 작을경우 원사이즈대로 출력
$img_height = $size[1];
$file[$i][aview] = "<tr><td width=$img_width>".view_file_link($write["wr_file".$i])."</td></tr>";
}
}
}
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][aview]) { echo $file[$i][aview]; }
}
echo "</table>";
?>
<!--
<table align=left width= cellpadding=0 cellspacing=0 STYLE='margin-right:10px'><tr><td>
<?
for ($i=1; $i<=1; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
<? if ($write[wr_1]) { echo "<center><font color=cf4900>$write[wr_1]</font></center>"; } ?> <?// 사진설명?>
</td></tr><tr><td>
<?
for ($i=2; $i<=2; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
<? if ($write[wr_2]) { echo "<center><font color=cf4900>$write[wr_2]</font></center>"; } ?> <?// 사진설명?>
</td></tr></table>
-->
오 배치를 옆에다가 하니까 괜찮네요 저도이거 적용 ㄳ~
<table align=right width= cellpadding=0 cellspacing=0 STYLE='margin-left:10px'><tr><td>
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
</td></tr></table>
이거 그대로 복사 붙여넣기~
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
</td></tr></table>
이거 그대로 복사 붙여넣기~
ENVY 님 감사합니다.
아래와 같이 하여 해결하였습니다.
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo "<table align=left width= cellpadding=0 cellspacing=0 STYLE='margin-right:10px'><tr><td>" .view_file_link($write["wr_file".$i]). "</td></tr></table>"; }
}
?>
하지만 첨부이미지가 두개일때 세로로 정렬이 되어야 하는데 가로로 되어 있습니다.
다시한번 고수님들의 자문을 구합니다.
참고링크 : http://cpu.nozo.net/?doc=bbs/gnuboard.php&bo_table=news&page=6&wr_id=30
아래와 같이 하여 해결하였습니다.
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo "<table align=left width= cellpadding=0 cellspacing=0 STYLE='margin-right:10px'><tr><td>" .view_file_link($write["wr_file".$i]). "</td></tr></table>"; }
}
?>
하지만 첨부이미지가 두개일때 세로로 정렬이 되어야 하는데 가로로 되어 있습니다.
다시한번 고수님들의 자문을 구합니다.
참고링크 : http://cpu.nozo.net/?doc=bbs/gnuboard.php&bo_table=news&page=6&wr_id=30
아아 실수 { } 이거 써야 하네 -_-;
잠시만요. 연구좀 해보고 다시... 기달려보세요. ㅎㅎㅎ
잠시만요. 연구좀 해보고 다시... 기달려보세요. ㅎㅎㅎ
Array[view] 로 표시되고 있네요.
{ } 로 묶지 마시고 echo"어쩌구 저쩌구 자시구"; <?=$file[$i][view]?> echo"또 어쩌구 저쩌구 태그"; 이렇게 표현식을 변경해보시지요? 제가 쓴것도 틀린거 같아요. -_-; php 문자열 결합구조를 잘 몰라서리 -_-;
{ } 로 묶지 마시고 echo"어쩌구 저쩌구 자시구"; <?=$file[$i][view]?> echo"또 어쩌구 저쩌구 태그"; 이렇게 표현식을 변경해보시지요? 제가 쓴것도 틀린거 같아요. -_-; php 문자열 결합구조를 잘 몰라서리 -_-;
아래와 같이 수정을 하였는데도 이미지 출력이 되지 않습니다. ㅜ.ㅜ
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo "<p align=right STYLE='margin-left:10px'> $file[$i][view] </p>"; }
}
?>
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo "<p align=right STYLE='margin-left:10px'> $file[$i][view] </p>"; }
}
?>