User Images not all loading
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2023 04:30 AM
I was wondering if anyone else is having this issue, on Rome. I am building a locator so you can search users, with images. I load 50 at a time and update using server.update() passing values in c.data and displaying as <image> with source NUMBER.iix, but after a page or two the images begin to stop loading and show broken (sporadically and random, more as the pages go on). When you refresh the page they usually come back. I looked in dev tools and the images are not even listed in sources. The same thing happens in CMS list view if you show images there. Is there a property that limits the number of images/attachments or is it limiting because of caching?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2023 07:19 AM
It is possible that the issue you are experiencing with images not loading in the locator is due to a limitation in the browser's cache. When the browser loads a large number of images, it may not be able to store all of them in its cache, which can cause some of the images to be displayed as broken.
To mitigate this issue, you can try the following:
- Set the "Expires" header for the images to a date in the past, so that the browser will always request a fresh copy of the image from the server instead of using a cached version. You can do this by adding the following code to your server-side script:
response.addHeader('Expires', 'Fri, 01 Jan 1990 00:00:00 GMT');
​
- Use a "Cache-Control" header with a "max-age" value of 0, which tells the browser to always check with the server for a new version of the image:
response.addHeader('Cache-Control', 'max-age=0');
​
- Use a unique URL for each image, so that the browser will treat each image as a separate cache entry. You can do this by adding a query parameter to the URL that is unique for each image, such as a timestamp or a random number.
I hope these suggestions help. If you are still experiencing issues with images not loading, you may need to consider using a different solution, such as lazy loading the images or using a server-side solution to cache
the images.
For example, you could use the GlideRecord API to query the sys_attachment table and retrieve the images in batches, rather than loading all of the images at once. This would allow you to load the images as needed, which would reduce the load on the browser's cache and improve performance.
Alternatively, you could use a server-side solution to cache the images, such as a reverse proxy or a content delivery network (CDN). This would allow you to store the images on a separate server or network of servers, which would be more efficient at serving the images to the users.
Kindly mark the response as Correct or Helpful.
Cheers,
Anish