xref: /PHP-8.3/ext/standard/php_image.h (revision cfa72ff3)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Authors: Rasmus Lerdorf <rasmus@php.net>                             |
14    |          Marcus Boerger <helly@php.net>                              |
15    +----------------------------------------------------------------------+
16 */
17 
18 #ifndef PHP_IMAGE_H
19 #define PHP_IMAGE_H
20 
21 /* {{{ enum image_filetype
22    This enum is used to have ext/standard/image.c and ext/exif/exif.c use
23    the same constants for file types.
24 */
25 typedef enum
26 { IMAGE_FILETYPE_UNKNOWN=0,
27   IMAGE_FILETYPE_GIF=1,
28   IMAGE_FILETYPE_JPEG,
29   IMAGE_FILETYPE_PNG,
30   IMAGE_FILETYPE_SWF,
31   IMAGE_FILETYPE_PSD,
32   IMAGE_FILETYPE_BMP,
33   IMAGE_FILETYPE_TIFF_II, /* intel */
34   IMAGE_FILETYPE_TIFF_MM, /* motorola */
35   IMAGE_FILETYPE_JPC,
36   IMAGE_FILETYPE_JP2,
37   IMAGE_FILETYPE_JPX,
38   IMAGE_FILETYPE_JB2,
39   IMAGE_FILETYPE_SWC,
40   IMAGE_FILETYPE_IFF,
41   IMAGE_FILETYPE_WBMP,
42   /* IMAGE_FILETYPE_JPEG2000 is a userland alias for IMAGE_FILETYPE_JPC */
43   IMAGE_FILETYPE_XBM,
44   IMAGE_FILETYPE_ICO,
45   IMAGE_FILETYPE_WEBP,
46   IMAGE_FILETYPE_AVIF,
47 /* WHEN EXTENDING: PLEASE ALSO REGISTER IN basic_function.stub.php */
48   IMAGE_FILETYPE_COUNT
49 } image_filetype;
50 /* }}} */
51 
52 PHPAPI int php_getimagetype(php_stream *stream, const char *input, char *filetype);
53 
54 PHPAPI char * php_image_type_to_mime_type(int image_type);
55 
56 PHPAPI bool php_is_image_avif(php_stream *stream);
57 
58 #endif /* PHP_IMAGE_H */
59