mirror of
https://github.com/claradex/nativegallery.git
synced 2024-11-15 03:31:10 +03:00
26 lines
519 B
PHP
26 lines
519 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Services;
|
||
|
|
||
|
|
||
|
class EXIF
|
||
|
|
||
|
{
|
||
|
|
||
|
public function __construct($file)
|
||
|
{
|
||
|
$exif = exif_read_data($file, 0, true);
|
||
|
$jsonData = [];
|
||
|
|
||
|
if ($exif !== false) {
|
||
|
foreach ($exif as $key => $section) {
|
||
|
foreach ($section as $name => $val) {
|
||
|
$jsonData["$key.$name"] = $val;
|
||
|
}
|
||
|
}
|
||
|
return json_encode($jsonData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
}
|