Open In App

PHP | Gmagick getimagedelay() Function

Last Updated : 21 Jan, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The Gmagick::getimagedelay() function is an inbuilt function in PHP which is used to get the image delay. The delay is actually the time taken for the transition from one image to another in a gif animation.

Syntax:

int Gmagick::getimagedelay( void )

Parameters: This function doesn’t accepts any parameters.

Return Value: This function returns an integer value containing the image delay in centiseconds (100centi = 1sec).

Exceptions: This function throws GmagickException on error.

Below given programs illustrate the Gmagick::getimagedelay() function in PHP:

Program 1:




<?php
  
// Create a new Gmagick object
$gmagickAnimation = new Gmagick('g4gnanimation1.gif');
  
// Get the delay
$delay = $gmagickAnimation->getimagedelay();
echo $delay;
?>


Output:

100 // which means 1 second.

Program 2:




<?php
  
// Create a new Gmagick object
$gmagickAnimation = new Gmagick('g4gnanimation1.gif');
  
// Set the delay
$gmagickAnimation->setimagedelay(200);
  
// Get the delay
$delay = $gmagickAnimation->getimagedelay();
echo $delay;
?>


Output:

200

Reference: https://www.php.net/manual/en/gmagick.getimagedelay.php


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads