PHP image_type_to_extension - 画像拡張子の取得
image_type_to_extension — 指定された画像タイプに応じた拡張子を返す。
構文
string image_type_to_extension ( int $imagetype [, bool $include_dot = TRUE ] )
指定された定数 IMAGETYPE_XXX に基づいて拡張子を返します。
例
<?php // 创建图像实例 $im = imagecreatetruecolor(100, 100); // 保存图像 png 格式 imagepng($im, './test' . image_type_to_extension(IMAGETYPE_PNG)); imagedestroy($im); ?>
上記のファイルを実行すると、カレントディレクトリに test.png の画像が生成されます。
その他の拡張機能
PHP 画像処理