php_gd.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. | Stig Bakken <ssb@php.net> |
  15. +----------------------------------------------------------------------+
  16. */
  17. #ifndef PHP_GD_H
  18. #define PHP_GD_H
  19. #include "zend_string.h"
  20. #include "php_streams.h"
  21. #if defined(HAVE_LIBGD) || defined(HAVE_GD_BUNDLED)
  22. /* open_basedir and safe_mode checks */
  23. #define PHP_GD_CHECK_OPEN_BASEDIR(filename, errormsg) \
  24. if (!filename || php_check_open_basedir(filename)) { \
  25. php_error_docref(NULL, E_WARNING, errormsg); \
  26. RETURN_FALSE; \
  27. }
  28. #define PHP_GDIMG_TYPE_GIF 1
  29. #define PHP_GDIMG_TYPE_PNG 2
  30. #define PHP_GDIMG_TYPE_JPG 3
  31. #define PHP_GDIMG_TYPE_WBM 4
  32. #define PHP_GDIMG_TYPE_XBM 5
  33. #define PHP_GDIMG_TYPE_XPM 6
  34. #define PHP_GDIMG_TYPE_GD 8
  35. #define PHP_GDIMG_TYPE_GD2 9
  36. #define PHP_GDIMG_TYPE_GD2PART 10
  37. #define PHP_GDIMG_TYPE_WEBP 11
  38. #define PHP_GDIMG_TYPE_BMP 12
  39. #define PHP_GDIMG_TYPE_TGA 13
  40. #define PHP_GDIMG_TYPE_AVIF 14
  41. #define PHP_IMG_GIF 1
  42. #define PHP_IMG_JPG 2
  43. #define PHP_IMG_JPEG 2
  44. #define PHP_IMG_PNG 4
  45. #define PHP_IMG_WBMP 8
  46. #define PHP_IMG_XPM 16
  47. #define PHP_IMG_WEBP 32
  48. #define PHP_IMG_BMP 64
  49. #define PHP_IMG_TGA 128
  50. #define PHP_IMG_AVIF 256
  51. #ifdef PHP_WIN32
  52. # ifdef PHP_GD_EXPORTS
  53. # define PHP_GD_API __declspec(dllexport)
  54. # else
  55. # define PHP_GD_API __declspec(dllimport)
  56. # endif
  57. #elif defined(__GNUC__) && __GNUC__ >= 4
  58. # define PHP_GD_API __attribute__ ((visibility("default")))
  59. #else
  60. # define PHP_GD_API
  61. #endif
  62. PHPAPI extern const char php_sig_gif[3];
  63. PHPAPI extern const char php_sig_jpg[3];
  64. PHPAPI extern const char php_sig_png[8];
  65. PHPAPI extern const char php_sig_bmp[2];
  66. PHPAPI extern const char php_sig_riff[4];
  67. PHPAPI extern const char php_sig_webp[4];
  68. PHPAPI extern const char php_sig_avif[4];
  69. extern zend_module_entry gd_module_entry;
  70. #define phpext_gd_ptr &gd_module_entry
  71. #include "php_version.h"
  72. #define PHP_GD_VERSION PHP_VERSION
  73. /* gd.c functions */
  74. PHP_MINFO_FUNCTION(gd);
  75. PHP_MINIT_FUNCTION(gd);
  76. PHP_MSHUTDOWN_FUNCTION(gd);
  77. PHP_RSHUTDOWN_FUNCTION(gd);
  78. PHP_GD_API struct gdImageStruct *php_gd_libgdimageptr_from_zval_p(zval* zp);
  79. #else
  80. #define phpext_gd_ptr NULL
  81. #endif
  82. #endif /* PHP_GD_H */