Add photo usage detection if not exist on thumbnail save

This commit is contained in:
Max Kostikov 2019-05-08 00:49:41 +02:00
parent f0933b66a9
commit de5d7bfbd3

View File

@ -508,6 +508,18 @@ abstract class PhotoDriver {
$arr['imgscale'] = $scale;
if(! array_key_exists('photo_usage', $arr)) {
$x = q("SELECT photo_usage FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = %d LIMIT 1",
dbesc($arr['resource_id']),
intval($arr['uid']),
intval($arr['imgscale'])
);
if($x)
$arr['photo_usage'] = $r[0]['photo_usage'];
else
return false;
}
if(boolval(get_config('system','filesystem_storage_thumbnails', 0)) && $scale > 0) {
$channel = \App::get_channel();
$arr['os_storage'] = 1;