aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-22 19:22:52 +0000
committerMario <mario@mariovavti.com>2020-10-22 19:22:52 +0000
commit2772c335635aa5248a4509e0976432707b3e716e (patch)
tree4e2c4cc1e95ef1543bc999ea4d9a05aa3580bfdc
parent78f655f877d2d2b7afd6d606edabc5b0df638738 (diff)
downloadvolse-hubzilla-2772c335635aa5248a4509e0976432707b3e716e.tar.gz
volse-hubzilla-2772c335635aa5248a4509e0976432707b3e716e.tar.bz2
volse-hubzilla-2772c335635aa5248a4509e0976432707b3e716e.zip
load eager in items - lazy breaks collapsing of long items with images
-rw-r--r--include/bbcode.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index c5d58e80d..d79429719 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -218,7 +218,7 @@ function bb_replace_images($body, $images) {
// We're depending on the property of 'foreach' (specified on the PHP website) that
// it loops over the array starting from the first element and going sequentially
// to the last element
- $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . $image .'" alt="' . t('Image/photo') . '" loading="lazy" />', $newbody);
+ $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . $image .'" alt="' . t('Image/photo') . '" loading="eager" />', $newbody);
$cnt++;
}
// logger('replace_images: ' . $newbody);
@@ -881,7 +881,7 @@ function bb_imgoptions($match) {
// now assemble the resulting img tag from these components
- $output = '<img ' . (($match[1] === 'z') ? 'class="zrl" loading="lazy"' : '') . ' ';
+ $output = '<img ' . (($match[1] === 'z') ? 'class="zrl" loading="eager"' : '') . ' ';
if ($width) {
$style .= 'width: 100%; max-width: ' . $width . 'px; ';
@@ -1483,19 +1483,19 @@ function bbcode($Text, $options = []) {
// Images
// [img]pathtoimage[/img]
if (strpos($Text,'[/img]') !== false) {
- $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="lazy" />', $Text);
+ $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="eager" />', $Text);
}
// [img=pathtoimage]image description[/img]
if (strpos($Text,'[/img]') !== false) {
- $Text = preg_replace("/\[img=http(.*?)\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="lazy" />', $Text);
+ $Text = preg_replace("/\[img=http(.*?)\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="eager" />', $Text);
}
// [zmg]pathtoimage[/zmg]
if (strpos($Text,'[/zmg]') !== false) {
- $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="lazy" />', $Text);
+ $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="eager" />', $Text);
}
// [zmg=pathtoimage]image description[/zmg]
if (strpos($Text,'[/zmg]') !== false) {
- $Text = preg_replace("/\[zmg=http(.*?)\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="lazy" />', $Text);
+ $Text = preg_replace("/\[zmg=http(.*?)\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="eager" />', $Text);
}
$Text = preg_replace_callback("/\[([zi])mg([ \=])(.*?)\](.*?)\[\/[zi]mg\]/ism",'bb_imgoptions',$Text);