이미지 여러 개 보여주기 채택완료
</strong></p>
<p>$sql = " select * from g5_board_file where wr_id = '$wr_id' and bo_table = '$bo_table'";
$qr = sql_query($sql);
for ($i=0; $row=sql_fetch_array($qr); $i++) {
$bf_file1 = $row[bf_file];
}
?>
<? if($bf_file1) { ?>
<?
$img = "<img src='<a href="http://$_SERVER[SERVER_NAME]/data/file/$bo_table/$bf_file1'>
";" target="_blank" rel="noopener noreferrer">http://$_SERVER[SERVER_NAME]/data/file/$bo_table/$bf_file1'>
";</a>
?>
<?}?>
<?
$subject = $wr_subject;
$content = $wr_content;
$link1 ='
<a href="'.$wr_link1.'">'.$wr_link1.'</a>';
$link2 ='
<a href="'.$wr_link2.'">'.$wr_link2.'</a';
?>
<?
$return = newPost(iconv('UTF-8', 'UTF-8' ,''.$subject), iconv('UTF-8', 'UTF-8',''.$img.$content.$link1.$link2), $category, $tags);
echo '<pre>';
?></p>
<p><strong>
위 부분에서 이미지가 여러개 업로드 됐을 때
이미지를 다 보여주려면 어떻게 해야할까요?
답변 2개
보여주기만 하면 되는거라면 아래와 같이 하면 됩니다.
</p>
<p><?</p>
<p>$sql = " select * from g5_board_file where wr_id = '$wr_id' and bo_table = '$bo_table'";</p>
<p>$qr = sql_query($sql);</p>
<p>for ($i=0; $row=sql_fetch_array($qr); $i++) {</p>
<p>?></p>
<p><img src='<a href="http://$_SERVER[SERVER_NAME]/data/file/$bo_table/<?" target="_blank" rel="noopener noreferrer">http://$_SERVER[SERVER_NAME]/data/file/$bo_table/<?</a> echo $row['bf_file']?>'></p>
<p><?</p>
<p>} </p>
<p>?></p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
include_once('xmlrpc.inc');
$title = $wr_subject; //글 작성시의 제목
$description = $wr_content; //글작성시의 내용
$category = $board[bo_subject]; //블로그의 카테고리와 똑 같은 카테고리가 존재해야 합니다. 아니면 포스팅 되지 않아요.
$tags = $wr_1;//테그입력
function newPost($title, $description, $category, $tags) {
$g_blog_url = "https://api.blog.naver.com/xmlrpc";
$user_id = " "; //네이버아이디
$blogid = " "; //네이버아이디
$password = " "; //아까 불로그 API에서 받은 비밀번호
$publish = true;
$client = new xmlrpc_client($g_blog_url);
$client->setSSLVerifyPeer(false);
$GLOBALS['xmlrpc_internalencoding']='UTF-8';
$struct = array(
'title' => new xmlrpcval($title, "string"),
'description' => new xmlrpcval($description, "string"),
'categories' => new xmlrpcval($category, "string"),
'tags' => new xmlrpcval($tags, "string")
);
$f = new xmlrpcmsg("metaWeblog.newPost",
array(
new xmlrpcval($blogid, "string"),
new xmlrpcval($user_id, "string"),
new xmlrpcval($password, "string"),
new xmlrpcval($struct , "struct"),
new xmlrpcval($publish, "boolean")
)
);
$f->request_charset_encoding = 'UTF-8';
return $response = $client->send($f);
}
//$여기서 부터 이미지 2개 이상 올리기 좀 구현해주세요... ㅜ,.ㅜ
$sql = " select * from g5_board_file where wr_id = '$wr_id' and bo_table = '$bo_table'";
$qr = sql_query($sql);
for ($i=0; $row=sql_fetch_array($qr); $i++) {
$bf_file1 = $row[bf_file];
}
?>
<? if($bf_file1) { ?>
<?
$img = "<img src='http://$_SERVER[SERVER_NAME]/data/file/$bo_table/$bf_file1'><br>";
?>
<?}?>
<?
$subject = $wr_subject;
$content = $wr_content;
$link1 ='<br><a href="'.$wr_link1.'">'.$wr_link1.'</a>';
$link2 ='<br><a href="'.$wr_link2.'">'.$wr_link2.'</a>';
?>
<?
$return = newPost(iconv('UTF-8', 'UTF-8' ,''.$subject), iconv('UTF-8', 'UTF-8',''.$img.$content.$link1.$link2), $category, $tags);
echo '<pre>';
?>
전체 소스입니다.
for 문 중 $bf_file1 이부분을 손봐야 할 것 같습니다.
$img 전체가 for 문으로 묶여할 것 같긴 한데요...
감사합니다만 답변 주신 방법으로는 되지 않았습니다. ㅜ,.ㅜ