note 108818 added to imagick.getimageiterations
| From: | holdoffhunger at gmail dot com | Date: | Sat, 26 May 2012 23:22:38 +0000 |
| Subject: | note 108818 added to imagick.getimageiterations | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188256@lists.php.net to get a copy of this message | ||
By using the PHP function getImageIterations, you'll receive back a value indicating the
animated nature of the image. You'll get back a '0' for a still image that is not
animated (like a .BMP or a .JPEG file) and a '1' for an animated image (like an animated
.GIF file).
I have been unable to get any other results from this function, after extensive use. There is some
discussion among the ImageMagick user's group saying that the Iterations should indicate the
number of times an animated .Gif file repeats itself. However, it's possible that either
modern browsers default the value to infinity or that this ImageMagick functionality is only
available at the Linux command-line. See more at the discussion group here: http://studio.imagemagick.org/pipermail/magick-users/2002-October/005814.html
And some sample code :
<?php
// Author: holdoffhunger@gmail.com
// Imagick Type
// ---------------------------------------------
$imagick_type = new Imagick();
// Open File
// ---------------------------------------------
$file_to_grab = "image_workshop_directory/test.gif";
$file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
// Grab File
// ---------------------------------------------
$imagick_type->readImageFile($file_handle_for_viewing_image_file);
// Get Image Iterations
// (Detect Animated Image Versus Non-Animated Image)
// ---------------------------------------------
$image_iterations = $imagick_type->getImageIterations();
// Print Iteration Value Interpreted
// ---------------------------------------------
if($image_iterations == 1)
{
print("$file_to_grab *IS* an animated image.");
}
else
{
print("$file_to_grab *IS NOT* an animated image.");
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 68.9.137.178
----
Manual Page -- http://www.php.net/manual/en/imagick.getimageiterations.php
Edit -- https://master.php.net/note/edit/108818
Del: integrated -- https://master.php.net/note/delete/108818/integrated
Del: useless -- https://master.php.net/note/delete/108818/useless
Del: bad code -- https://master.php.net/note/delete/108818/bad+code
Del: spam -- https://master.php.net/note/delete/108818/spam
Del: non-english -- https://master.php.net/note/delete/108818/non-english
Del: in docs -- https://master.php.net/note/delete/108818/in+docs
Del: other reasons-- https://master.php.net/note/delete/108818
Reject -- https://master.php.net/note/reject/108818
Search -- https://master.php.net/manage/user-notes.php