썸네일 이미지 삭제하는법 좀!! > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

썸네일 이미지 삭제하는법 좀!! 정보

썸네일 이미지 삭제하는법 좀!!

본문

썸네일 게시판에서 썸네일이 없다면 생성을 해서 썸네일로 보여주는 식으로 게시판을 사용하고있습니다.
헌데... 생성은 죽도록 하는데... 삭제되는 부분은 없더라구욤;
그리고 썸네일 이미지파일을 지정 할 때 확장자가 없어서 그런가 생성은 되는데 삭제가 안됩니다;
아래 소스는 write_update.php에서 update쿼리를 날리는 부분입니다.
수정모드 일때 날리는 쿼리부분 바로아래에 소스 한줄 추가해줬는데;;
그걸 어찌해야 할까요 ㅠㅠ? 그런 형식이 아닌건가여?
어찌해야 썸네일 삭제코드가 구현되는지 도움 부탁드립니다.

for ($i=0; $i<count($upload); $i++)
{
    $row = sql_fetch(" select count(*) as cnt from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
    if ($row[cnt])
    {
        // 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.
        // 그렇지 않다면 내용만 업데이트 합니다.
        if ($upload[$i][del_check] || $upload[$i][file])
        {
            $sql = " update $g4[board_file_table]
                        set bf_source = '{$upload[$i][source]}',
                            bf_file = '{$upload[$i][file]}',
                            bf_content = '{$bf_content[$i]}',
                            bf_filesize = '{$upload[$i][filesize]}',
                            bf_width = '{$upload[$i][image][0]}',
                            bf_height = '{$upload[$i][image][1]}',
                            bf_type = '{$upload[$i][image][2]}',
                            bf_datetime = '$g4[time_ymdhis]'
                      where bo_table = '$bo_table'
                        and wr_id = '$wr_id'
                        and bf_no = '$i' ";
            sql_query($sql);
        }
        else
        {
            $sql = " update $g4[board_file_table]
                        set bf_content = '{$bf_content[$i]}'
                      where bo_table = '$bo_table'
                        and wr_id = '$wr_id'
                        and bf_no = '$i' ";
            sql_query($sql);



*****이런식으로 소스를 넣어 수정할 때에 썸네일을 삭제하고 다시 생성되게 하려합니다*****
          @unlink("$g4[path]/data/file/$bo_table/thumb/$wr_id");//수정시 썸네일도 삭제




        }
    }
    else
    {
        $sql = " insert into $g4[board_file_table]
                    set bo_table = '$bo_table',
                        wr_id = '$wr_id',
                        bf_no = '$i',
                        bf_source = '{$upload[$i][source]}',
                        bf_file = '{$upload[$i][file]}',
                        bf_content = '{$bf_content[$i]}',
                        bf_download = 0,
                        bf_filesize = '{$upload[$i][filesize]}',
                        bf_width = '{$upload[$i][image][0]}',
                        bf_height = '{$upload[$i][image][1]}',
                        bf_type = '{$upload[$i][image][2]}',
                        bf_datetime = '$g4[time_ymdhis]' ";
        sql_query($sql);
    }
}
  • 복사

댓글 전체

어렵게 사용하시네요. 썸네일 폴더를 따로 두어 별도로 관리하는게 어떨까요?

thumb 디렉토리만 삭제하면, 모든 썸네일은 다 지워지건든요. ㅋ


실제 업로드된 이미지 경로
http://zombi.kr/data/file/3_1/2038530385_368eae2b_1.jpg

썸네일 생성된 이미지 경로
http://zombi.kr/data/thumb/3_1/120x91/2038530385_368eae2b_1.jpg
© SIRSOFT
현재 페이지 제일 처음으로