알짜게시판

[PHP] Imagek 를 이용한 썸네일 생성

[code] <?php // Imagik 를 이용한 썸네일 생성 function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_height) {    $thumbname = 'thumb-'.preg_replace("/\.[^\.]+$/i", "", $filename).'_'.$thumb_width.'x'.$thumb_height.'.png';    $thumb_file = $target_path.'/'.$thumbname;    if(is_file($thumb_file)) return $thumbname;    $source_file = $source_path.'/'.$filename;    if(!is_file($source_file)) return;    $img = new Imagick($source_file);    $img->thumbnailImage($thumb_width, $thumb_height);    $img->setImageFormat('png');    $img->writeImage($thumb_file);    return $thumbname; } // 사용하기 $thumbname = thumbnail('원본파일명', '원본파일경로', '썸네일저장경로', '썸네일 넓이', '썸네일 높이'); if($thumbname) {    header('Expires: '.gmdate('D, d M Y H:i:s', time()+(60*60*24*365)).' GMT');    header('Cache-Control: max-age='.(60*60*24*365));    header('Pragma: public');    header('Content-Type: image/png');    $fp = fopen($filepath.'/'.$thumbname, 'rb');    if (!fpassthru($fp)) fclose($fp); } [/code]

로그인 후 댓글내용을 입력해주세요

번호 제목 글쓴이 조회 날짜
71 [아이폰] HTTPS 감청 우회하기 302,603 11-01
70 [그누보드] SmartEditor2Skin.html 다운로드 되는 현상 109,705 01-08
69 [윈도우] C:\Windows\Installer 폴더 다른 드라이브로 옮기기 104,522 05-29
68 [PHP] REQUEST 값 받기(application/json 포함) 98,941 04-20
67 [윈도우] 아이폰 벨소리 쉽게 추가하기 93,875 06-14
66 [MySQL] 업데이트 이후 에러 발생([ERROR] Incorrect definition of table … 91,654 12-08
65 [MySQL] MySQL, MariaDB 업데이트 73,676 11-24
64 구글 크롬 탭검색 비활성화 72,541 12-04
63 [크롬] 개발자 도구(DevTools)에서 붙여넣기 안될때 71,596 03-10
62 [리눅스] 데몬(systemd service) 작성 및 실행하기 65,918 03-14
61 [ReactNative] android directory was detected in the project. 65,557 07-20
60 [윈도우] 윈도우11 시작 메뉴 위치 변경(가운데, 왼쪽) 60,629 10-10
59 [리눅스] 구글 크롬 콘솔 'Attestation check for Topics on' 에러 원인 & 해결방… 59,366 04-11
58 [리눅스] yum 에서 Thread died in Berkeley DB library 오류 59,227 09-18
57 [Delphi] 중복 실행 방지 59,076 09-21
56 [리눅스] 메일(Mail) 삭제/초기화 58,413 07-18
55 [리눅스] 로그 삭제 및 비우기(?) 58,325 09-09
54 Windows에 Rust 설치하기 57,595 10-05
53 [윈도우] node.js 와 npm 업데이트(업그레이드) 57,580 12-01
52 [ReactNative] 캐시 초기화 하는 방법 57,541 12-27
51 [리눅스] VNSTAT 설치하기 56,234 09-17
50 [PHP] 검색 로봇 접속시 종료 56,014 10-07
49 [Delphi] 윈도우 알림센터에 메시지 출력하기 55,660 06-20
48 [MySQL] unblock with 'mysqladmin flush-hosts' 에러 53,881 01-01
47 [FTP] 500 Illegal PORT command. 47,579 09-03
46 [윈도우] WSH script registration is not valid. 46,666 05-23
45 [워드프레스] 제목 블록 기본값을 H5로 변경하는 방법 46,453 05-22
44 [파이썬] 동영상 특정 영역 모자이크(흐리게) 하기 46,308 04-30
43 [윈도우] 파일 내용 검색 45,890 02-09
열람 [PHP] Imagek 를 이용한 썸네일 생성 45,858 08-26
41 [리눅스] .htaccess 를 이용해서 https 이동하기 45,455 08-31
목록