diff --git a/src/_h5ai/server/php/inc/class-thumb.php b/src/_h5ai/server/php/inc/class-thumb.php index 308707f4..17ce4412 100644 --- a/src/_h5ai/server/php/inc/class-thumb.php +++ b/src/_h5ai/server/php/inc/class-thumb.php @@ -16,6 +16,10 @@ class Thumb { $this->app = $app; $this->thumbs_path = CACHE_PATH . "/" . Thumb::$THUMB_CACHE; $this->thumbs_href = CACHE_HREF . Thumb::$THUMB_CACHE; + + if (!is_dir($this->thumbs_path)) { + @mkdir($this->thumbs_path, 0755, true); + } } @@ -29,10 +33,10 @@ class Thumb { if ($type === "img") { $capture_path = $source_path; } else if ($type === "mov") { - if (HAS_CMD_FFMPEG) { - $capture_path = $this->capture(Thumb::$FFMPEG_CMDV, $source_path); - } else if (HAS_CMD_AVCONV) { + if (HAS_CMD_AVCONV) { $capture_path = $this->capture(Thumb::$AVCONV_CMDV, $source_path); + } else if (HAS_CMD_FFMPEG) { + $capture_path = $this->capture(Thumb::$FFMPEG_CMDV, $source_path); } } else if ($type === "doc" && HAS_CMD_CONVERT) { $capture_path = $this->capture(Thumb::$CONVERT_CMDV, $source_path); @@ -48,10 +52,6 @@ class Thumb { return null; } - if (!is_dir($this->thumbs_path)) { - @mkdir($this->thumbs_path, 0755, true); - } - $name = "thumb-" . sha1("$source_path-$width-$height-$mode") . ".jpg"; $thumb_path = $this->thumbs_path . "/" . $name; $thumb_url = $this->thumbs_href . "/" . $name;