Syntax:int Imagick::getIteratorIndex (void)
Parameters:This function takes no parameters.
Return value:This function returns an integer value containing the index of the image on the stack.
Exceptions:This function throws an ImagickException on error.The following programs illustrate the
Imagick::getIteratorIndex() functionin PHP:
Program 1:
// Create a new imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
);
// Get index
$index
=
$imagick
-> getIteratorIndex();
echo
$index
;
?>
Output:0 // Which means the first image.
Program 2: < ? php
// Create a new imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
);
// Add two more images to the same imagick object
$imagick
-> addImage (
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
));
$imagick
-> addImage (
new
Imagick (
’ https://media. engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
));
// Get index
$index
=
$imagick
-> getIteratorIndex();
echo
$index
;
?>
Output:2 // Which means the third image.
Link: https://www.php.net/manual/en/imagick.getiteratorindex.php
SO 1 data error