제

썸네일 여백 없애기 get_file_thumbnail, get_view_thumbnail

· 2023-05-18 (목) 00:38:03 · 4264

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,788건
+
제목 글쓴이 날짜 조회
23-07-30 조회 3,913
23-07-28 조회 4,694
23-07-25 조회 6,070
23-07-19 조회 4,677
23-07-12 조회 4,006
23-07-07 조회 5,253
23-07-07 조회 5,184
23-07-06 조회 4,548
23-07-03 조회 5,484
23-07-01 조회 4,430
23-06-30 조회 5,105
23-06-29 조회 6,831
23-06-25 조회 4,141
23-06-22 조회 4,473
23-06-17 조회 4,161
23-06-16 조회 4,692
23-06-12 조회 6,039
23-05-27 조회 4,873
23-05-26 조회 5,095
23-05-26 조회 4,603
23-05-23 조회 5,029
23-05-22 조회 5,619
23-05-22 조회 4,597
23-05-18 조회 5,012
23-05-18 조회 4,265
23-05-17 조회 5,104
23-05-16 조회 6,576
23-05-13 조회 4,476
23-05-12 조회 4,748
23-05-10 조회 4,808