PHP | Imagick readImages() Function
Last Updated :
04 Dec, 2019
The Imagick::readImages() function is an inbuilt function in PHP which is used to read images from an array of filenames and associate them to a single Imagick object.
Syntax:
bool Imagick::readImages( array $filenames )
Parameters:This function accepts a single parameter $filenames which holds an array containing all the filenames.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below programs illustrate the Imagick::readImages() function in PHP:
Program 1:
<?php
$imagick = new Imagick();
$images = [
];
$imagick ->readImages( $images );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Program 2:
<?php
$imagick = new Imagick();
$images = [
];
$imagick ->readImages( $images );
$imagick ->setIteratorIndex(0);
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Program 3:
<?php
$imagick = new Imagick();
$images = [
'filename1.png' ,
'filename2.png'
];
$imagick ->readImages( $images );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
It will show filename2.png on the screen.
Reference: https://www.php.net/manual/en/imagick.readimages.php
Share your thoughts in the comments
Please Login to comment...