English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
image_type_to_extension — Returns the corresponding file extension based on the specified image type.
string image_type_to_extension ( int $imagetype [, bool $include_dot = TRUE ] )
Returns the file extension based on the given constant IMAGETYPE_XXX.
<?php // Create image example $im = imagecreatetruecolor(100, 100); // Save image in 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.