Open In App

PHP | Gmagick getimagefilename() Function

Improve
Improve
Like Article
Like
Save
Share
Report

The Gmagick::getimagefilename() function is an inbuilt function in PHP which is used to get the filename of a particular image in a sequence.

Syntax:

string Gmagick::getimagefilename( void )

Parameters: This function doesn’t accept any parameter.

Return Value: This function returns an string value containing the filename.

Exceptions: This function throws GmagickException on error.

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

Program 1:




<?php
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
   
// Get the filename
$name = $gmagick->getimagefilename();
echo $name;
?>


Output:

geeksforgeeks.png

Program 2:




<?php
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
  
// Rename the image
$gmagick->setimagefilename('my_new_name.png');
  
// Get the filename
$name = $gmagick->getimagefilename();
echo $name;
?>


Output:

my_new_name.png

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


Last Updated : 21 Jan, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads