Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXIF not supported for GIF #2246

Merged
merged 1 commit into from
Sep 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions system/Images/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* CodeIgniter
*
Expand Down Expand Up @@ -61,36 +60,42 @@ abstract class BaseHandler implements ImageHandlerInterface
* @var \CodeIgniter\Images\Image
*/
protected $image = null;

/**
* Image width.
*
* @var integer
*/
protected $width = 0;

/**
* Image height.
*
* @var integer
*/
protected $height = 0;

/**
* File permission mask.
*
* @var type
*/
protected $filePermissions = 0644;

/**
* X-axis.
*
* @var integer
*/
protected $xAxis = 0;

/**
* Y-axis.
*
* @var integer
*/
protected $yAxis = 0;

/**
* Master dimensioning.
*
Expand Down Expand Up @@ -513,6 +518,8 @@ public function reorient(bool $silent = false)
* Retrieve the EXIF information from the image, if possible. Returns
* an array of the information, or null if nothing can be found.
*
* EXIF data is only supported fr JPEG & TIFF formats.
*
* @param string|null $key If specified, will only return this piece of EXIF data.
*
* @param boolean $silent If true, will not throw our own exceptions.
Expand All @@ -529,10 +536,16 @@ public function getEXIF(string $key = null, bool $silent = false)
}
}

$exif = exif_read_data($this->image->getPathname());
if (! is_null($key) && is_array($exif))
$exif = null; // default
switch ($this->image->imageType)
{
$exif = $exif[$key] ?? false;
case IMAGETYPE_JPEG:
case IMAGETYPE_TIFF_II:
$exif = exif_read_data($this->image->getPathname());
if (! is_null($key) && is_array($exif))
{
$exif = $exif[$key] ?? false;
}
}

return $exif;
Expand Down Expand Up @@ -800,6 +813,7 @@ protected function reproportion()
}

//--------------------------------------------------------------------

/**
* Return image width.
*
Expand Down