array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'function.image-type-to-extension.php', 1 => 'image_type_to_extension', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'Fonctions GD et images', ), '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' => 'fr', '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 — Retourne l'extension du fichier pour le type d'image
image_type_to_extension() retourne l'extension
pour la constante IMAGETYPE_XXX
fournie.
image_type
Une des constantes IMAGETYPE_XXX
.
include_dot
Si l'on doit ajouter un point à l'extension ou non.
Par défaut, vaut true
.
Une chaîne de caractères avec l'extension, correspondant au type de
l'image fournie, ou false
si une erreur survient.
Exemple #1 Exemple avec image_type_to_extension()
<?php
// Création d'une instance d'image
$im = imagecreatetruecolor(100, 100);
// Sauvegarde de l'image
imagepng($im, './test' . image_type_to_extension(IMAGETYPE_PNG));
imagedestroy($im);
?>
Note:
Cette fonction ne nécessite pas la bibliothèque GD.