array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.image-type-to-extension.php', 1 => 'image_type_to_extension', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'GD および Image 関数', ), 'prev' => array ( 0 => 'function.getimagesizefromstring.php', 1 => 'getimagesizefromstring', ), 'next' => array ( 0 => 'function.image-type-to-mime-type.php', 1 => 'image_type_to_mime_type', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/image/functions/image-type-to-extension.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
image_type_to_extension — 画像形式からファイルの拡張子を取得する
指定した定数 IMAGETYPE_XXX
に対応する拡張子を返します。
指定した型に対応する拡張子を文字列で返します。
失敗した場合に false
を返します
例1 image_type_to_extension() の例
<?php
// 画像のインスタンスを作成します
$im = imagecreatetruecolor(100, 100);
// 画像を保存します
imagepng($im, './test' . image_type_to_extension(IMAGETYPE_PNG));
imagedestroy($im);
?>
注意:
この関数は、GD 画像ライブラリは必要ありません。