이미지 처리 및 GD imagecreatetruecolor
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagecreatetruecolor — 새로운 트루 컬러 이미지 생성
설명
imagecreatetruecolor(int $width
, int $height
): GdImage|false
imagecreatetruecolor()는 지정된 크기의 검은색 이미지를 나타내는 이미지 객체를 반환합니다.
매개변수
width
- 이미지 너비.
height
- 이미지 높이.
반환 값
성공하면 이미지 개체를 반환하고 오류에는 false
를 반환합니다.
변경 로그
버전 | 설명 |
---|---|
8.0.0 | 성공하면 이 함수는 이제 GdImage 인스턴스를 반환합니다. 이전에는 리소스가 필요했습니다. |
Examples
예제 #1 새 GD 이미지 스트림을 만들고 이미지를 출력합니다.
<?php
header ('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);
?>
위의 예는 다음과 유사한 결과를 출력합니다.
기타
- imagedestroy() - 이미지 파괴
- imagecreate() - 새 팔레트 기반 이미지 만들기