PHP Imagick getFormat () function

PHP

Syntax:
string Imagick::getFormat (void)
Parameters:This function takes no parameters.Exceptions:This function throws an ImagickException on error.Return value:this function returns a string value on success.The following programs illustrate the Imagick::getFormat() functionin PHP:Program 1:  
// Create a new imagick object $imagick = new Imagick();  
// Get format $format = $imagick -> getFormat(); echo $format ; ?>
Output:
It will return an empty string which is the default format.
Program 2:  
// Create a new imagick object $imagick = new Imagick ( ` https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ` );  
// Set format $imagick -> setFormat ( `png` );  
// Get format $format = $imagick -> getFormat(); echo $format ; ?>
Output:
png
Link: https:// www .php.net / manual / en / imagick.getformat.php



Get Solution for free from DataCamp guru