Easy Tutorial
❮ Func Zip Entry Compressedsize Func Date Timezone Identifiers List ❯

PHP image_type_to_extension - Get Image Extension

PHP Image Processing

image_type_to_extension — Returns the extension for the specified image type.

Syntax

string image_type_to_extension ( int $imagetype [, bool $include_dot = TRUE ] )

Returns the extension based on the given IMAGETYPE_XXX constant.

Example

<?php
// Create an image instance
$im = imagecreatetruecolor(100, 100);

// Save the 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.

PHP Image Processing

❮ Func Zip Entry Compressedsize Func Date Timezone Identifiers List ❯