- ⌂ ImageData
- Methods
- Static Methods
ImageData::get_format()
Get the image file format based on the image format.
Prototype
string get_format()
Return
The image file format. Common image file formats include:
- PNG
- JPEG
- GIF
Example
// load a PNG image from the web
$url = 'https://www.webcomand.com/docs/img/note.png';
$image = get_file_contents($url);
$image = new \io_comand_image\models\ImageData($image);
// get the PNG format
$before = $image->get_format();
// change the image format to JPEG
$image->set_format('JPEG');
// get the JPEG format
$after = $image->get_format();
// display the format from before and after conversion
echo("Converted image from $before to $after.\n");