Api: Log an error if the thumbnail cache directory does not exist and cannot be created

This commit is contained in:
nathangray 2021-03-09 11:08:03 -07:00
parent d013249851
commit cc06432951

View File

@ -150,6 +150,10 @@ function read_thumbnail($src)
} }
$dst = gen_dstfile($stat && !empty($stat['url']) ? $stat['url'] : $src, $maxsize, $height, $width, $minsize); $dst = gen_dstfile($stat && !empty($stat['url']) ? $stat['url'] : $src, $maxsize, $height, $width, $minsize);
$dst_dir = dirname($dst); $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)) if(file_exists($dst_dir))
{ {
// Check whether the destination file already exists and is newer than // Check whether the destination file already exists and is newer than