PHP image_type_to_extension - Get Image Extension
image_type_to_extension — Returns the corresponding extension name based on the specified image type.
Syntax
string image_type_to_extension ( int $imagetype [, bool $include_dot = TRUE ] )
Returns the extension name based on the given constant IMAGETYPE_XXX.
Example
Running the file above will generate a test.png image in the current directory.
PHP Image Processing