Jump to content

How to display page while images are getting resized?


Recommended Posts

I love ProcessWire and I've been using it almost exclusively for the last 8 years.
One thing that has never improved though is how the page loading is blocked while waiting for ALL images to be resized in the frontend. This is ok for a basic page with a single hero image and another 2-3 in the content but is seriously problematic for gallery pages or sites with loads of images.
First page load can be incredibly long, or potentially time out.

Would it not be much more user friendly if the page would display and images would appear when they are available in the requested size? I came from Drupal 7 where this was the normal behaviour, it was a shock with ProcessWire and unfortunately this is still the case.

Is there a technical reason why it MUST be like this? While ideally this would be a feature in the core, what workaround do you all use to display the html/css/javascript while images are getting resized?

Is there a module I've missed before?

  • Like 1
Link to comment
Share on other sites

Thanks @szabesz, I'm aware that it's possible but I don't want to pre-generate all image sizes for all images automatically. For example Drupal 7 resizes images on the fly too, based on image presets, yet the page displays and images load as they are generated. I am just hoping that it's possible to achieve something like this in template files.

  • Like 2
Link to comment
Share on other sites

I know this behaviour and it bothers me on every project. I always get a 500 time out error when loading loads of images the first time. This happens mostly in my local dev environment, though.
The live server seems to be powerful enough to handle it faster without the timeout.

Link to comment
Share on other sites

31 minutes ago, ngrmm said:

I'm curious and would like to know how the Drupal way handles the problem of layout shifts if images and image dimensions are not available on load?

Dimensions are available since they are based on image presets and Drupal includes width and height attributes I believe. We can do the same in ProcessWire but the page is not even sent until all the images in the template got resized that can take minutes for a gallery page. When including links to larger image variations, even images in the links get resized before the page can load even though they are not displayed immediately and could wait until someone clicks the link.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...