From cc064329515faceb3ff579844749064d545f8a9e Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 9 Mar 2021 11:08:03 -0700 Subject: [PATCH] Api: Log an error if the thumbnail cache directory does not exist and cannot be created --- api/thumbnail.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/thumbnail.php b/api/thumbnail.php index 7294562a15..03bb43bf27 100644 --- a/api/thumbnail.php +++ b/api/thumbnail.php @@ -150,6 +150,10 @@ function read_thumbnail($src) } $dst = gen_dstfile($stat && !empty($stat['url']) ? $stat['url'] : $src, $maxsize, $height, $width, $minsize); $dst_dir = dirname($dst); + if(!file_exists($dst_dir) && !mkdir($dst_dir, 0700, true)) + { + error_log(__FILE__ . " Unable to cache thumbnail. Check $dst_dir exists and web server has write access."); + } if(file_exists($dst_dir)) { // Check whether the destination file already exists and is newer than