aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Photo/PhotoDriver.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-05-08 00:49:41 +0200
committerMax Kostikov <max@kostikov.co>2019-05-08 00:49:41 +0200
commitde5d7bfbd312e020bbc10e92e28db76bf52a4b75 (patch)
tree3660ffe5313a0bb325de85c817e058009ef205e0 /Zotlabs/Photo/PhotoDriver.php
parentf0933b66a9115aaa208a6273fa243c71cf37a1d7 (diff)
downloadvolse-hubzilla-de5d7bfbd312e020bbc10e92e28db76bf52a4b75.tar.gz
volse-hubzilla-de5d7bfbd312e020bbc10e92e28db76bf52a4b75.tar.bz2
volse-hubzilla-de5d7bfbd312e020bbc10e92e28db76bf52a4b75.zip
Add photo usage detection if not exist on thumbnail save
Diffstat (limited to 'Zotlabs/Photo/PhotoDriver.php')
-rw-r--r--Zotlabs/Photo/PhotoDriver.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/Zotlabs/Photo/PhotoDriver.php b/Zotlabs/Photo/PhotoDriver.php
index c1993ac20..a1fba5615 100644
--- a/Zotlabs/Photo/PhotoDriver.php
+++ b/Zotlabs/Photo/PhotoDriver.php
@@ -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;