View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0036690 | mantisbt | html | public | 2025-11-14 12:55 | 2025-11-18 05:48 |
| Reporter | info@gritsch-soft.com | Assigned To | |||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | acknowledged | Resolution | open | ||
| Product Version | 2.27.2 | ||||
| Summary | 0036690: Add a global setting to disable lazy-loading of images. | ||||
| Description | It would be great to have a (global) setting to disable the lazy loading of preview-images (that makes scrolling jumpy and with a fast internet-connection or in LAN eager loading would not be a problem). Currently we are using the following patch to change it on every mantis-update:
Thank you for the great work! | ||||
| Tags | No tags attached. | ||||
Making lazy loading optional certainly is one way to deal with the shifting layout problem, but in my opinion eager loading of attachment previews it a waste of bandwidth regardless of how fast the connection is, which is the main reason why this was implemented in the first place (see 27150). I believe it would be a much better fix to add appropriate width/height attributes to img tag, to ensure the display renders correctly sized placeholders, thus avoiding layout shifting. This could probably be achieved fairly easily using PHP's getimagesize() function - it even returns an appropriate pre-formatted string. Let me know your thoughts. |
|
|
That would be a possible solution. But the info (size) should be stored in the DB to prevent a waste of CPU und Disk-acitivity (images need to be stored on disk to use with that function). |
|
True, for optimization it would be best to store width/height in DB when the attachment is uploaded.
Not necessarily, there is also getimagesizefromstring(), which can take the contents of the BLOB when the attachment is stored in DB.
Not so complex actually - here is a proof-of-concept (not integrating schema change and storage of size info) if you'd like to test it. Of course it's wasteful because multiple queries against bug_file table are made, and we're reading the image file from disk twice (once to get the size, and again to actually load the image), but it should work. |
|