PHP | Imagick setImageFilename() Function
Last Updated :
19 Nov, 2019
The Imagick::setImageFilename() function is an inbuilt function in PHP which is used to set the filename of a particular image.
Syntax:
bool Imagick::setImageFilename( string $filename )
Parameters: This function accepts single parameter $filename which holds a string that represent the filename.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below programs illustrate the Imagick::setImageFilename() function in PHP:
Program 1:
<?php
$imagick = new Imagick(
$imagick ->setImageFilename( 'myNewFilename.png' );
$name = $imagick ->getImageFilename();
echo $name ;
?>
|
Output:
myNewFilename.png
Program 2:
<?php
$imagick = new Imagick(
$imagick ->setImageFilename( 'myAnotherNewFilename.png' );
$name = $imagick ->getImageFileName();
$imagick ->writeImage( $name );
?>
|
Output:
This program creates a file called myAnotherNewFilename.png in the same folder.
Reference: https://www.php.net/manual/en/imagick.setimagefilename.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...