11<?php
2-
32/**
43 * CodeIgniter
54 *
@@ -61,36 +60,42 @@ abstract class BaseHandler implements ImageHandlerInterface
6160 * @var \CodeIgniter\Images\Image
6261 */
6362 protected $ image = null ;
63+
6464 /**
6565 * Image width.
6666 *
6767 * @var integer
6868 */
6969 protected $ width = 0 ;
70+
7071 /**
7172 * Image height.
7273 *
7374 * @var integer
7475 */
7576 protected $ height = 0 ;
77+
7678 /**
7779 * File permission mask.
7880 *
7981 * @var type
8082 */
8183 protected $ filePermissions = 0644 ;
84+
8285 /**
8386 * X-axis.
8487 *
8588 * @var integer
8689 */
8790 protected $ xAxis = 0 ;
91+
8892 /**
8993 * Y-axis.
9094 *
9195 * @var integer
9296 */
9397 protected $ yAxis = 0 ;
98+
9499 /**
95100 * Master dimensioning.
96101 *
@@ -513,6 +518,8 @@ public function reorient(bool $silent = false)
513518 * Retrieve the EXIF information from the image, if possible. Returns
514519 * an array of the information, or null if nothing can be found.
515520 *
521+ * EXIF data is only supported fr JPEG & TIFF formats.
522+ *
516523 * @param string|null $key If specified, will only return this piece of EXIF data.
517524 *
518525 * @param boolean $silent If true, will not throw our own exceptions.
@@ -529,10 +536,16 @@ public function getEXIF(string $key = null, bool $silent = false)
529536 }
530537 }
531538
532- $ exif = exif_read_data ( $ this -> image -> getPathname ());
533- if (! is_null ( $ key ) && is_array ( $ exif ) )
539+ $ exif = null ; // default
540+ switch ( $ this -> image -> imageType )
534541 {
535- $ exif = $ exif [$ key ] ?? false ;
542+ case IMAGETYPE_JPEG :
543+ case IMAGETYPE_TIFF_II :
544+ $ exif = exif_read_data ($ this ->image ->getPathname ());
545+ if (! is_null ($ key ) && is_array ($ exif ))
546+ {
547+ $ exif = $ exif [$ key ] ?? false ;
548+ }
536549 }
537550
538551 return $ exif ;
@@ -800,6 +813,7 @@ protected function reproportion()
800813 }
801814
802815 //--------------------------------------------------------------------
816+
803817 /**
804818 * Return image width.
805819 *
0 commit comments