aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-05-23 18:56:09 +0000
committerMario <mario@mariovavti.com>2022-05-23 18:56:09 +0000
commite146a67f4b34a067229f008e9f6ddff95da18e67 (patch)
treea9291e6e75eb99b59d9ff48f64eaec0df01da45c /include
parent162d86983a86b9dd3a1af6a10d260658021a1e35 (diff)
downloadvolse-hubzilla-e146a67f4b34a067229f008e9f6ddff95da18e67.tar.gz
volse-hubzilla-e146a67f4b34a067229f008e9f6ddff95da18e67.tar.bz2
volse-hubzilla-e146a67f4b34a067229f008e9f6ddff95da18e67.zip
fix photo permission if a photo description is available and use the filename as default photo description if uploading via the editor
Diffstat (limited to 'include')
-rw-r--r--include/items.php6
-rw-r--r--include/photos.php6
2 files changed, 8 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php
index d93b9aaaf..d4c27ab28 100644
--- a/include/items.php
+++ b/include/items.php
@@ -4831,7 +4831,10 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body,
$match = null;
// match img and zmg image links
if(preg_match_all("/\[[zi]mg(.*?)\](.*?)\[\/[zi]mg\]/",$body,$match)) {
- $images = $match[2];
+
+ // The URI can be in both places
+ $images = array_merge($match[1], $match[2]);
+
if($images) {
foreach($images as $image) {
if(! stristr($image,z_root() . '/photo/'))
@@ -4849,6 +4852,7 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body,
dbesc($image_uri),
intval($uid)
);
+
if($r && $r[0]['folder']) {
$f = q("select * from attach where hash = '%s' and is_dir = 1 and uid = %d limit 1",
dbesc($r[0]['folder']),
diff --git a/include/photos.php b/include/photos.php
index 5bceb516d..9e4e8923d 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -359,13 +359,13 @@ function photo_upload($channel, $observer, $args) {
$scale = 1;
$width = $url[1]['width'];
$height = $url[1]['height'];
- $tag = (($r1) ? '[zmg=' . $width . 'x' . $height . ']' : '[zmg]');
+ $tag = (($r1) ? '[zmg=' . $url[1]['href'] . ']' : '[zmg]');
}
else {
$scale = 2;
$width = $url[2]['width'];
$height = $url[2]['height'];
- $tag = (($r2) ? '[zmg=' . $width . 'x' . $height . ']' : '[zmg]');
+ $tag = (($r2) ? '[zmg=' .$url[2]['href'] . ']' : '[zmg]');
}
$author_link = '[zrl=' . z_root() . '/channel/' . $channel['channel_address'] . ']' . $channel['channel_name'] . '[/zrl]';
@@ -379,7 +379,7 @@ function photo_upload($channel, $observer, $args) {
$summary = (($args['body']) ? $args['body'] : '') . '[footer]' . $activity_format . '[/footer]';
$obj_body = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']'
- . $tag . z_root() . "/photo/{$photo_hash}-{$scale}." . $ph->getExt() . '[/zmg]'
+ . $tag . $filename . '[/zmg]'
. '[/zrl]';
$url[] = [