bool Imagick::setFilename (string $filename)Parameters:This function takes one parameter, $filename,which contains a string representing the file name.Return value:this the function returns TRUE on success.The following programs illustrate the Imagick::setFilename() functionin PHP:Program 1:
// Create a new imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
);
// Set file name
$imagick
-> setFilename (
’myNewFilename.png’
);
// Get file name
$name
=
$imagick
-> getFilename();
echo
$name
;
?>
Output:myNewFilename.png
Program 2:
// Create a new imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
);
// Set file name
$imagick
-> setFilename (
’myAnotherNewFilename.png’
);
// Get file name
$name
=
$imagick
-> getFileName();
// Save the image to the same folder
$imagick
-> writeImage (
$name
);
?>
Output:This program creates a file called myAnotherNewFilename.png in the same folder.
Link: https://www.php.net/ manual / en / imagick.setfilename.php
Shop
Latest questions
Wiki