컴퓨터/개발

썸네일 생성

하늘치 2014. 2. 18. 13:33
반응형

출처1 : http://www.tested.co.kr/board/Talk/view/sfl/wr_subject.wr_content/stx/.EC.8D.B8.EB.84.A4.EC.9D.BC/wr_id/447


출처2 : http://musecom.net/board/muse01/view/wr_id/1/page/4

도움2 : http://musecom.net/board/muse01/view/wr_id/2/page/4


마냐님 보드에서 에디터로 업로드한 이미지의 썸네일을 만들 때..


Latest_model.php 에서 아래 소스를 넣는다...




            /** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            * [2014-02-17] 본문의 에디터로 등록한 이미지 썸네일 가져오기
            */
            $thumb_name = "";
            if($thumb_width > 0) {
                if($row['wr_count_image'] > 0){
                    //가장 작은 이미지 하나만 쿼리
                    $this->db->select_min('bf_no');
                    $query = $this->db->get_where('ki_board_file', array(
                         'bo_table' => $row['bo_table'],
                        'wr_id' => $row['wr_id'],
                        'bf_editor' => 1
                        ));
                    $row1 = $query->row_array();
                    $this->db->select('bf_file');
                    $qry = $this->db->get_where('ki_board_file', array(
                        'bo_table' => $row['bo_table'],
                        'wr_id' => $row['wr_id'],
                        'bf_editor' => 1,
                        'bf_no' => $row1['bf_no']
                    ));
                    $row2 = $qry->row_array();
                    $this->load->helper('resize');
                    $thumb_name = resize_thumb($row2['bf_file'] , $row['bo_table'], $thumb_width);  // 메인에서는 208
                }
            }
            $list[$i]->thumb_image  = $thumb_name;


반응형