PHP | exif_imagetype() function Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The exif_imagetype() function is an inbuilt function in PHP which is used to determine the type of an image.Syntax: int exif_imagetype( string $filename ) Parameters:This function accepts a single parameter $filename which holds the name or URL of the image.Return Value: This function returns an integer corresponding to one of IMAGETYPE constants as given below: IMAGETYPE_GIF (1)IMAGETYPE_JPEG (2)IMAGETYPE_PNG (3)IMAGETYPE_SWF (4)IMAGETYPE_PSD (5)IMAGETYPE_BMP (6)IMAGETYPE_TIFF_II (7)IMAGETYPE_TIFF_MM (8)IMAGETYPE_JPC (9)IMAGETYPE_JP2 (10)IMAGETYPE_JPX (11)IMAGETYPE_JB2 (12)IMAGETYPE_SWC (13)IMAGETYPE_IFF (14)IMAGETYPE_WBMP (15)IMAGETYPE_XBM (16)IMAGETYPE_ICO (17)IMAGETYPE_WEBP (18) Below given programs illustrate the exif_imagetype() function in PHP: Program 1: In this example we will check the format of a image file. php <?php // Load an image from PNG URL $type = exif_imagetype( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); echo $type; ?> Output: 3 // which corresponds to IMAGETYPE_PNG Program 2: In this example we will check if a image file is supported or not. php <?php // Load an image from JPEG URL $type = exif_imagetype( 'https://media.geeksforgeeks.org/wp-content/uploads/20200123100652/geeksforgeeks12.jpg'); if($type > 0 || $type < 19) { echo 'This is a supported image format.'; } ?> Output: This is a supported image format. Reference: https://www.php.net/manual/en/function.exif-imagetype.php Comment More infoAdvertise with us Next Article PHP | exif_imagetype() function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | imagetypes() Function The imagetypes() function is an inbuilt function in PHP which is used to return the image types supported by the PHP inbuilt installed library. Syntax: int imagetypes( void ) Parameters: This function does not accept any parameter. Return Value: This function returns the bit-field corresponding to t 1 min read PHP | imagejpeg() Function The imagejpeg() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to JPEG and altering the quality of the image. Syntax: bool imagejpeg( resource $image, int $to, in 2 min read PHP gettype() Function The PHP gettype() function returns the type of a variable as a string. It identifies the variable's data type, such as string, integer, array, boolean, etc., allowing developers to check and handle different data types dynamically.Syntax:string gettype ( $var )Parameter: This function accepts a sing 2 min read PHP | imagesy() Function The imagesy() function is an inbuilt function in PHP which is used to return the height of the given image. Syntax: int imagesy( $image ) Parameters: This function accepts single parameters $image which is mandatory. This $image variable store the image created by imagecreatetruecolor() image creati 1 min read PHP | imagepng() Function The imagepng() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to PNG and applying filters to the image. Syntax: bool imagepng( resource $image, int $to, int $qual 2 min read Like