PHP image_type_to_extension - Get Picture suffix
PHP image_type_to_extension - Get Picture suffix
image_type_to_extension - returns the corresponding extension according to the specified image type.
grammar
string image_type_to_extension ( int $imagetype [, bool $include_dot = TRUE ] )
According to the given constant IMAGETYPE_XXX return extension.
Examples
<?php // 创建图像实例 $im = imagecreatetruecolor(100, 100); // 保存图像 png 格式 imagepng($im, './test' . image_type_to_extension(IMAGETYPE_PNG)); imagedestroy($im); ?>
Implementation of the above file will generate a test.png pictures in the current directory.