image_type_to_extension — Returns the corresponding suffix name according to the specified image type.
string image_type_to_extension ( int $imagetype [, bool $include_dot = TRUE ] )
Returns the suffix name based on the given constant IMAGETYPE_XXX.
<?php// Create image instance $im = imagecreatetruecolor(100, 100);// Save image png format imagepng($im, './test' . image_type_to_extension(IMAGETYPE_PNG));imagedestroy($im);?>
Executing the above file will generate a test.png image in the current directory.