PHP | Gmagick getimageiterations() Function
Last Updated :
21 Jan, 2020
The Gmagick::getimageiterations() function is an inbuilt function in PHP which is used to get the image iterations. Iterations actually mean the number of times frames are shown in an image which is 0 in case of a still image and 1 in case of animation.
Syntax:
int Gmagick::getimageiterations( void )
Parameters: This function doesn’t accept any parameters.
Return Value: This function returns an integer value containing the image iterations which is 0 in case of a still image and 1 in case of animations.
Exceptions: This function throws GmagickException on error.
Below given programs illustrate the Gmagick::getimageiterations() function in PHP:
Program 1:
<?php
$gmagick = new Gmagick( './geeksforgeeks.png' );
$iterations = $gmagick ->getimageiterations();
echo $iterations ;
?>
|
Output:
0 // Because this is a still image.
Program 2:
<?php
$gmagickAnimation = new Gmagick( 'g4gnanimation1.gif' );
$iterations = $gmagickAnimation ->getimageiterations();
echo $iterations ;
?>
|
Output:
1 // Because this is a animation.
Reference: https://www.php.net/manual/en/gmagick.getimageiterations.php
Share your thoughts in the comments
Please Login to comment...