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

Commit

Permalink
Move check for exiftool to useExiftool function
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Rasmussen <[email protected]>
  • Loading branch information
mir07 committed Feb 11, 2019
1 parent ceab99b commit 5d29972
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 7 additions & 10 deletions php/Modules/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1063,16 +1063,13 @@ public function getInfo($url) {
$exif = false;
if(Settings::useExiftool()) {
Log::notice(Database::get(), __METHOD__, __LINE__, 'Using exiftool');
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];
}
$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
2 changes: 2 additions & 0 deletions php/Modules/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ public static function setDefaultLicense($license) {
* @return bool Returns the useExiftool setting.
*/
public static function useExiftool() {
system('which exiftool 2>&1 > /dev/null', $status);
if ($status != 0) return false;
return (bool) (self::get()['useExiftool'] === '1');
}

Expand Down

0 comments on commit 5d29972

Please sign in to comment.