Piwigo / piwigo-openstreetmap

OpenStreetMap integration for Piwigo
http://piwigo.org/ext/extension_view.php?eid=701
GNU General Public License v3.0
35 stars 35 forks source link

Reduce loaded thumbnails #196

Open mistic100 opened 3 years ago

mistic100 commented 3 years ago

When accessing the map, the bottom navbar is initialized with the thumbnails of ALL images available on the map (basically all images of the gallery).

This puts a very high load on the server and the browser (in my case initializing more than 2000 li+img elements). I even get banned from my host because of suspicious usage.

Could you make an update to only load ~20 thumbnails, and if needed, lazy load the others when using the arrows ?

mistic100 commented 3 years ago

Related to #150 and #189

mistic100 commented 1 year ago

FYI I dropped this whole block on my local installation to be able to use this plugin without being banned

https://github.com/Piwigo/piwigo-openstreetmap/blob/5732e09980fbe76b55283679a792bf0f5f5ac239/template/osm-map2.tpl#L454-L474

mistic100 commented 1 year ago

This doesn't even require any scripting on modern browsers https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading#images_and_iframes