라이브러리
[PHP] Imagick::getImageAttribute - 명명된 속성을 반환합니다.
Imagick::getImageAttribute
Imagick::getImageAttribute 메서드는 현재 이미지의 특정 속성을 반환합니다. 이 메서드는 Imagick 객체의 속성을 조회할 때 사용됩니다.
사용 방법
Imagick::getImageAttribute 메서드는 다음과 같은 형식으로 사용됩니다.
#hostingforum.kr
php
Imagick::getImageAttribute(string $attribute)
* `$attribute`: 조회할 속성의 이름입니다.
예제
다음 예제에서는 Imagick::getImageAttribute 메서드를 사용하여 현재 이미지의 크기를 조회합니다.
#hostingforum.kr
php
// Imagick 객체를 생성합니다.
$image = new Imagick('example.jpg');
// 현재 이미지의 크기를 조회합니다.
$width = $image->getImageAttribute('width');
$height = $image->getImageAttribute('height');
// 크기를 출력합니다.
echo "이미지 크기: $width x $height
";
지원하는 속성
Imagick::getImageAttribute 메서드는 다음과 같은 속성을 지원합니다.
* `width`: 이미지의 너비를 반환합니다.
* `height`: 이미지의 높이를 반환합니다.
* `format`: 이미지의 형식을 반환합니다.
* `colorspace`: 이미지의 색 공간을 반환합니다.
* `compression`: 이미지의 압축 알고리즘을 반환합니다.
* `interlace`: 이미지의 인터 레이스 모드를 반환합니다.
예제 (속성 조회)
다음 예제에서는 Imagick::getImageAttribute 메서드를 사용하여 현재 이미지의 속성을 조회합니다.
#hostingforum.kr
php
// Imagick 객체를 생성합니다.
$image = new Imagick('example.jpg');
// 속성을 조회합니다.
$width = $image->getImageAttribute('width');
$height = $image->getImageAttribute('height');
$format = $image->getImageAttribute('format');
$colorspace = $image->getImageAttribute('colorspace');
$compression = $image->getImageAttribute('compression');
$interlace = $image->getImageAttribute('interlace');
// 속성을 출력합니다.
echo "속성:
";
echo " 너비: $width
";
echo " 높이: $height
";
echo " 형식: $format
";
echo " 색 공간: $colorspace
";
echo " 압축 알고리즘: $compression
";
echo " 인터 레이스 모드: $interlace
";
이 예제에서는 현재 이미지의 속성을 조회하고 출력합니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.