댓글 검색 목록

[php] 이미지 자르기

페이지 정보

작성자 운영자 작성일 15-05-18 21:45 조회 2,073 댓글 0

<?php

$filename= "images/ima4.jpg";

list($w, $h, $type, $attr) = getimagesize($filename);

$src_im = imagecreatefromjpeg($filename);

$src_x = '100'; // begin x

$src_y = '100'; // begin y

$src_w = '100'; // width

$src_h = '100'; // height

$dst_x = '0'; // destination x

$dst_y = '0'; // destination y

$dst_im = imagecreatetruecolor($src_w, $src_h);

$white = imagecolorallocate($dst_im, 255, 255, 255);

imagefill($dst_im, 0, 0, $white);

imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);

header("Content-type: image/png");

imagepng($dst_im);

imagedestroy($dst_im);

?> 

댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.