Skip to content

Update BaseHandler::getEXIF #3568

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

Merged
merged 1 commit into from
Aug 30, 2020
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
6 changes: 5 additions & 1 deletion system/Images/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,8 @@ public function reorient(bool $silent = false)
* @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.
*
* @throws \CodeIgniter\Images\Exceptions\ImageException
*
* @return mixed
*/
public function getEXIF(string $key = null, bool $silent = false)
Expand All @@ -607,14 +609,16 @@ public function getEXIF(string $key = null, bool $silent = false)
{
return null;
}

throw ImageException::forEXIFUnsupported(); // @codeCoverageIgnore
}

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