본문 바로가기
PHP

PHP 이미지 리사이즈 함수 imagecopyresized

by 씨엔아이소프트 2017. 9. 27.
반응형

PHP 이미지 리사이즈 함수  imagecopyresized



예제


<?php
// File and new size
$filename 'test.jpg';
$percent 0.5;

// Content type
header('Content-Type: image/jpeg');

// Get new sizes
list($width$height) = getimagesize($filename);
$newwidth $width $percent;
$newheight $height $percent;

// Load
$thumb imagecreatetruecolor($newwidth$newheight);
$source imagecreatefromjpeg($filename);

// Resize
imagecopyresized($thumb$source0000$newwidth$newheight$width$height);

// Output
imagejpeg($thumb);
?>

반응형

'PHP' 카테고리의 다른 글

PHP 파일 업로드 FORM 처리  (0) 2018.06.12
php 5.3 register_blogals 삭제 대체  (0) 2018.06.12
PHP http -> https 로 전환  (0) 2017.08.10
PHP - 공공 DATA XML 파싱(PHP 버전)  (0) 2017.05.24
php www 붙이기  (0) 2017.03.28

댓글