XF 2.1 Distinguish internal images from external images

ForumGeek

Member
Hi,

I want to suspend the loading of external images (which have been posted using the [ IMG ] tag) until a consent is given (GDPR issue).

So far I have modified the rendering of the [ IMG ] tag (lightbox_macros and Html.php in the src/XF/BBcode/Renderer directory) to apply event-triggered lazy loading on the rendered < img > HTML-tags.

Obviously this modification affects all [ IMG ] tags, even if they point to the forum domain. I would accept this as long as the internal images which have been posted as attachments ( [ ATTACH ] tag) would be loaded directly (no modification of the < img > tags to wait for lazy loading). However, the [ ATTACH ] tag also is rendered like the [ IMG ] tag as long as it is not implemented as a thumbnail.

Is there a way to change either the behaviour of the rendering of the [ ATTACH ] tag (not being a thumbnail) seperately or to distinguish whether an [ IMG ] tag points to the forum domain itself?

Thank you in advance!
 
If anyone has a similar problem:

1. clone the lightbox_macros template
2. add the lazy loading adjustments for [ img ] code only in the original version of the lightbox_macros template
3. call the cloned (unmodified) version of lightbox_macros in the bb_code_tag_attach template

--> lazy loading is applied for external images only.
 
Back
Top Bottom