우리가 남이가? - <고수용버전>

우리가 남이가? - <고수용버전>

QA

우리가 남이가? - <고수용버전>

답변 2

본문

이렇게 말하면 

거의 모든 분이 남이라고 하시더라구요,,유유

 

암튼 늘 껄쩍지근한 질문만 드려서 미안합니다. 

 

파일업로드 갯수를 늘릴려면 어떻게 해야 하나요?

날짜를 2016-07-26 이렇게 나오게 하려면요? 

이런 질문들도 간혹 해야 하는데...유유

 

또 날짜가 바꿨군요,,,좋은 하루 되세요,..

 

질문: 댓글에서 체디터5로 멀티사진창에서 이미지를 업로드하는데...

이게 파일명이 랜덤으로 저장되어 리스트에 섬네일로 불러오려는데 

장난이 아닙니다.

 

(간단한) 방법이 있을까요?

 

체디터 업로드.php를 보니 이렇게 되어 있더군요..

 

<?php

// ---------------------------------------------------------------------------

//                              CHXImage

//

// 이 코드는 데모를 위해서 제공됩니다.

// 환경에 맞게 수정 또는 참고하여 사용해 주십시오.

//

// ---------------------------------------------------------------------------

 

require_once("_config.php");

 

//----------------------------------------------------------------------------

//

//

$tempfile = $_FILES['file']['tmp_name'];

$filename = md5($_SERVER['REMOTE_ADDR']).'_'.$_FILES['file']['name'];

 

// 저장 파일 이름

// md5(IP)_년월일시분초_랜덤문자4자.확장자

// 1234567890abcdef1234567890abcdef_20140327125959_abcd.jpg

$savefile = SAVE_DIR . '/' . $filename;

 

// 사용자PC의 파일 이름: $_POST["origName"]

// 사용자PC의 파일 경로: $_POST["filePath"]

// 사용자PC의 파일 크기: $_POST["filesize"]

 

// 파일의 확장자가 이미지가 아니라면 삭제

if (!preg_match("/.(gif|jpe?g|png)$/i", $savefile))

    unlink($savefile);

 

move_uploaded_file($tempfile, $savefile);

$imgsize = getimagesize($savefile);

$filesize = filesize($savefile);

 

if (!$imgsize) {

$filesize = 0;

$random_name = '-ERR';

unlink($savefile);

};

 

switch ($imgsize[2]) {

    case IMAGETYPE_GIF :    // 1

    case IMAGETYPE_JPEG :   // 2

    case IMAGETYPE_PNG :    // 3

        break;

    default :

        $filesize = 0;

        $random_name = '-ERR';

        unlink($savefile);

}

 

$rdata = sprintf('{"fileUrl": "%s/%s", "filePath": "%s", "fileName": "%s", "fileSize": "%d" }',

SAVE_URL,

$filename,

$savefile,

$filename,

$filesize );

 

echo $rdata;

?>


이 질문에 댓글 쓰기 :

답변 2

대충 불러오는 방식은


$query = " select wr_content from ".$write_table." where wr_parent = '".$wr_id."' and wr_is_comment > 0 ";
/*한개의 글만 검사 할 때*/ 
$row = sql_fetch($query);
echo get_view_thumbnail($row['wr_content']);
/*한개의 글만 검사 할 때*/
 
/*여러개의 글 검사 할 때*/
$result = sql_query($query); 
for($i=0; $row = sql_fetch_array($result); $i++) {
  echo get_view_thumbnail($row['wr_content']);
}
/*여러개의 글 검사 할 때*/
 

 

친절한 설명 감사합니다..
개념이 없어 이해는 어렵지만..ㅋ
본문 첨부파일 이미지는 이렇게 불러오던데..
제가 하고자 하는거는 어떻게 불러올지 어렵네요..
                    <?php
                    if (!$list[$i]['is_notice']) {
                        $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);

                        if($thumb['src']) {
                            $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
                        } else {
                            $img_content = '<img src="'.$board_skin_url.'/img/noimage.gif" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
                        }
                        echo $img_content;
                    }
                    ?>

그냥은 안돼고 위처럼 쿼리를 새로 날려서 댓글의 번호를 불러와야 합니다.
위 문장중 한개의 글만 검사할때는 빼고
여러개의 글 검사할때의 문장을 가져다가 적용시키세요
$wr_id 값만 $list[$i]['wr_id']로 바꾸면 되겠네요

위 쿼리를 if 닫히는 부분 위쪽에 넣어 주시면 되겠네요

이렇게 했더니 무한 로딩 걸리는군요,,,
<a href="<?php echo $list[$i]['href'] ?>">
                    <?php
                  if (!$list[$i]['is_notice']) {

$query = " select wr_content from ".$write_table." where wr_parent = '".$list[$i]['wr_id']."' and wr_is_comment > 0 ";

/*여러개의 글 검사 할 때*/
$result = sql_query($query);
for($i=0; $row = sql_fetch_array($result); $i++) {
  echo get_view_thumbnail($row['wr_content']);
}
/*여러개의 글 검사 할 때*/

                        $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
                        if($thumb['src']) {
                          $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
                        } else {
                            $img_content = '<img src="'.$board_skin_url.'/img/noimage.gif" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
                        }
                      echo $img_content;
                    }
                    ?>
                    </a>

그렇군요,,j로 바꿨더니 무한로딩은 안걸리는데,,이제 섬네일이 아니고 원본이 짠하고 등장하네요,,ㅋ
그리고 글 코멘트내용까지 리스트에 나타나구요,,,이건 또 어떻게 손봐야 하나..유유, 쉽지 않네요.,

get_view_thumbnail 이름을 바꾸면 섬네일 립.php에서 받아오지 않아 작동이 안될거 같은데요..

thumbnail.lip.php도 함께 수정하고 뭔가 작업을 해주어야 하는거죠? 휴

어려운거 시간내주셔서 늘 고맙습니다~
복잡해져서 새로 질문을 올려봐야겠습니다~
좋은 하루되세요~

내용에 저장된 이미지를 리스트페이지에서 썸네일로 불러오고 싶다는 건가요???

 

댓글 체디터에 12개 넣을 수 있던데요,,,리스트에는 6개만 불러오려고 합니다.


본문에 첨부파일로 올린거는 이런식으로 잘 불러왔는데요..
                    <?php
                    if (!$list[$i]['is_notice']) {

                        $thumb1 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '0');  //첫번째파일

                        if($thumb1['src']) {
                            $img_content = '<img src="'.$thumb1['src'].'" alt="'.$thumb1['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
                        } else {
                            $img_content = '<img src="'.$board_skin_url.'/img/noimage.gif" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
                        }
                        echo $img_content;


$thumb2 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '1');  //두번째파일
                        if($thumb2['src']) {
                            $img_content_0 = '<img src="'.$thumb2['src'].'" alt="'.$thumb2['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
                        } else {
                            $img_content_0 = '<img src="'.$board_skin_url.'/img/noimage.gif" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
                        }
                      echo $img_content_0;

 }
?>
</a>

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 12,369
© SIRSOFT
현재 페이지 제일 처음으로