php8.5
Home/ Manual/ imagick / imagick/ Imagick::pingImageFile

Imagick::pingImageFile

PHP function Edit on GitHub ✎

(PECL imagick 2, PECL imagick 3)

Get basic image attributes in a lightweight manner

Description

Imagick::pingImageFile(resource $filehandle, [string $fileName]): bool

This method can be used to query image width, height, size, and format without reading the whole image to memory. 0x629

Parameters

filehandle

An open filehandle to the image.

fileName

Optional filename for this image.

Return Values

Success

Examples

Using Imagick::pingImageFile()

Opening a remote location

php
<?php
/* fopen a remote location */
$fp = fopen("http://example.com/test.jpg");

/* create new imagick object */
$im = new Imagick();

/* pass the handle to imagick */
$im->pingImageFile($fp);
?>

See Also

Source: reference/imagick/imagick/pingimagefile.xml · from the official PHP manual (php/doc-en)