Skip to content
Related Articles

Related Articles

PHP | Gmagick getimagefilename() Function

View Discussion
Improve Article
Save Article
  • Last Updated : 21 Jan, 2020
View Discussion
Improve Article
Save Article

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!