richard
/
cyca
Archived
1
0
Fork 0
This repository has been archived on 2024-05-04. You can view files and clone it, but cannot push or open issues or pull requests.
cyca/app/Analyzers/ExifAnalyzer.php

35 lines
832 B
PHP
Executable File

<?php
namespace App\Analyzers;
/**
* Extract information from a supported image file.
*/
class ExifAnalyzer extends Analyzer
{
/**
* Analyzes document.
*/
public function analyze()
{
if (empty($this->body)) {
return;
}
$bodyPath = storage_path('app/'.$this->document->getStoragePath().'/body');
$this->details = exif_read_data($bodyPath, null, true, true);
if (empty($this->details)) {
return;
}
$this->document->description = (string) view('partials.details.image')->with([
'exif' => $this->details,
'url' => asset(str_replace('public', 'storage', $this->document->getStoragePath()).'/body'),
]);
$this->storeDetailsOnDisk();
$this->applyDetailsToDocument();
}
}