Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Add usage of exiftool to get exif tags from camera manufactures #189

Merged
merged 6 commits into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 12 additions & 9 deletions php/Modules/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1061,15 +1061,18 @@ public function getInfo($url) {
// Read EXIF
if ($info['mime']=='image/jpeg') {
$exif = false;
system('which exiftool 2>&1 > /dev/null', $status);
if ($status == 0) {
$handle = @popen("exiftool -php -q $url 2>&1", 'r');
$exiftool = @fread($handle, 8192);
@pclose($handle);
if (false!==$exiftool && strlen($exiftool) > 0) {
$exiftool = @eval('return ' . "$exiftool");
if (is_array($exiftool) && is_array($exiftool[0])) {
$exif = $exiftool[0];
if(Settings::useExiftool()) {
Log::notice(Database::get(), __METHOD__, __LINE__, 'Using exiftool');
system('which exiftool 2>&1 > /dev/null', $status);
if ($status == 0) {
ildyria marked this conversation as resolved.
Show resolved Hide resolved
$handle = @popen("exiftool -php -q $url 2>&1", 'r');
$exiftool = @fread($handle, 8192);
@pclose($handle);
if (false!==$exiftool && strlen($exiftool) > 0) {
$exiftool = @eval('return ' . "$exiftool");
if (is_array($exiftool) && is_array($exiftool[0])) {
$exif = $exiftool[0];
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions php/Modules/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function init($public = true) {
unset($return['config']['imagick']);
unset($return['config']['plugins']);
unset($return['config']['php_script_limit']);
unset($return['config']['useExiftool']);

}

Expand Down
16 changes: 16 additions & 0 deletions php/Modules/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,20 @@ public static function setDefaultLicense($license) {
return false;
}

/**
* @return bool Returns the useExiftool setting.
*/
public static function useExiftool() {
return (bool) (self::get()['useExiftool'] === '1');
ildyria marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* @return bool Set the useExiftool setting.
*/
public static function setUseExiftool($enable) {
ildyria marked this conversation as resolved.
Show resolved Hide resolved
Log::notice(Database::get(), __METHOD__, __LINE__, 'Change useExiftool to: ' . $enable);
if (self::set('useExiftool', $enable)===false) return false;
return true;
}

}