php | png 섬네일 생성시 배경색 투명 처리
페이지 정보
작성자 100K5 작성일15-10-21 18:22 조회59,198회 댓글0건관련링크
본문
<?php
$rewidth = "300";
$reheight = "300";
$dst = @imageCreatetrueColor($rewidth,$reheight);
@imagetruecolortopalette($dst, false, 255); // 이걸 해줘야 투명배경이 씌워진다 ?
// @imagecolorallocatealpha(이미지객체, 레드값, 그린값, 블루값, 알파값)
$back = @imagecolorallocatealpha($dst, 255, 255, 255, 127); // 투명배경을 씌운다
@imagefilledrectangle($dst, 0, 0, $rewidth,$reheight, $back);
$src = @ImageCreateFromPNG("orginal_img.png"); // 저장된 원본 이미지 경로 및 파일명
@imagecopyResampled($dst, $src,0,0,0,0,$rewidth,$reheight,ImageSX($src),ImageSY($src));
@Imagepng($dst,$imgpath."/".$dstimg);
?>
댓글목록
등록된 댓글이 없습니다.