썸네일 여백 없애기 get_file_thumbnail, get_view_thumbnail

· 2년 전 · 1804

thumbnail 함수에 $thumb_width 인수를 0으로 보내면 thumbnail 함수에서 thumb_height를 기준으로 원본이미지를 키워서 썸네일을 만듭니다.

 

function get_view_thumbnail($contents, $thumb_width=0)

{

...

 

            // Animated GIF 체크
            $is_animated = false;
            if($file_ext === 'gif') {
                $is_animated = is_animated_gif($srcfile);

                if($replace_content = run_replace('thumbnail_is_animated_gif_content', '', $contents, $srcfile, $is_animated, $img_tag, $data_path, $size)){

                    $contents = $replace_content;
                    continue;
                }
            }
            $thumb_width_tmp = $thumb_width;
            // 원본 width가 thumb_width보다 작다면
            if($size[0] <= $thumb_width)
            $thumb_width_tmp = 0;
                //continue;

            // 썸네일 높이
            $thumb_height = round(($thumb_width * $size[1]) / $size[0]);
            $filename = basename($srcfile);
            $filepath = dirname($srcfile);


            $thumb_width = $thumb_width_tmp;
            // 썸네일 생성
            if(!$is_animated)
                $thumb_file = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, false);
            else
                $thumb_file = $filename;

            if(!$thumb_file)
                continue;

 

...

|
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

+
제목 글쓴이 날짜 조회
2년 전 조회 2,433
2년 전 조회 4,127
2년 전 조회 1,575
2년 전 조회 1,956
2년 전 조회 1,654
2년 전 조회 2,165
2년 전 조회 3,253
2년 전 조회 2,360
2년 전 조회 2,547
2년 전 조회 2,087
2년 전 조회 2,389
2년 전 조회 2,984
2년 전 조회 2,065
2년 전 조회 2,425
2년 전 조회 1,805
2년 전 조회 2,429
2년 전 조회 3,928
2년 전 조회 1,879
2년 전 조회 2,125
2년 전 조회 2,020
2년 전 조회 2,310
2년 전 조회 5,255
2년 전 조회 2,208
2년 전 조회 3,262
2년 전 조회 2,201
2년 전 조회 1,627
2년 전 조회 2,649
2년 전 조회 2,306
2년 전 조회 2,300
2년 전 조회 2,058