aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-04-10 13:25:03 +0200
committerMario <mario@mariovavti.com>2019-04-10 13:25:03 +0200
commit8dc495c9bcd4e2e59b74913d20b12fada93c5004 (patch)
tree2bf3365bec1b814fa0d2f4d407dd75c96bc0762a /include
parent47fd95db9d2edc21f113e5843d87af9d9b62b243 (diff)
parent5d70d889e908a32c846b9da3eb26703064d20ec6 (diff)
downloadvolse-hubzilla-8dc495c9bcd4e2e59b74913d20b12fada93c5004.tar.gz
volse-hubzilla-8dc495c9bcd4e2e59b74913d20b12fada93c5004.tar.bz2
volse-hubzilla-8dc495c9bcd4e2e59b74913d20b12fada93c5004.zip
Merge branch 'dev' into 'dev'
Initial preparation to move local thumbnails in filesystem storage See merge request hubzilla/core!1585
Diffstat (limited to 'include')
-rw-r--r--include/attach.php11
-rw-r--r--include/import.php9
2 files changed, 15 insertions, 5 deletions
diff --git a/include/attach.php b/include/attach.php
index f6594b154..f169e0669 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -1521,6 +1521,17 @@ function attach_drop_photo($channel_id,$resource) {
if($x) {
drop_item($x[0]['id'],false,(($x[0]['item_hidden']) ? DROPITEM_NORMAL : DROPITEM_PHASE1),true);
}
+
+ $r = q("SELECT content FROM photo WHERE resource_id = '%s' AND uid = %d AND os_storage = 1",
+ dbesc($resource),
+ intval($channel_id)
+ );
+ if($r) {
+ foreach($r as $i) {
+ @unlink(dbunescbin($i['content']));
+ }
+ }
+
q("DELETE FROM photo WHERE uid = %d AND resource_id = '%s'",
intval($channel_id),
dbesc($resource)
diff --git a/include/import.php b/include/import.php
index 7a1e9aa55..21cdfb68f 100644
--- a/include/import.php
+++ b/include/import.php
@@ -1385,13 +1385,14 @@ function sync_files($channel, $files) {
else
$p['content'] = (($p['content'])? base64_decode($p['content']) : '');
- if(intval($p['imgscale']) && (! $p['content'])) {
+ if(intval($p['imgscale']) && intval($p['os_storage']) && (! empty($p['content']))) {
$time = datetime_convert();
- $parr = array('hash' => $channel['channel_hash'],
+ $parr = array(
+ 'hash' => $channel['channel_hash'],
'time' => $time,
- 'resource' => $att['hash'],
+ 'resource' => $p['resource_id'],
'revision' => 0,
'signature' => base64url_encode(rsa_sign($channel['channel_hash'] . '.' . $time, $channel['channel_prvkey'])),
'resolution' => $p['imgscale']
@@ -1414,8 +1415,6 @@ function sync_files($channel, $files) {
$x = z_post_url($fetch_url,$parr,$redirects,[ 'filep' => $fp, 'headers' => $headers]);
fclose($fp);
- $p['content'] = file_get_contents($stored_image);
- unlink($stored_image);
}
if(!isset($p['display_path']))