Problem/Motivation

getimagesize() calls are made to determine the dimensions of images, to be used eg. in calculations in image operations. When using remote file storages, every getimagesize() call results in the overhead + the cost of a network request to the external service.

Because of this, we want to avoid these calls. We're already doing that by overriding some of the image operations, but the dimensions are still accessed in validation and sometimes in the image widget. To make sure we're only doing this call once we could add a caching mechanism for image dimensions, keyed by the file URI.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork imgix-3257563

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DieterHolvoet created an issue. See original summary.

dieterholvoet’s picture

We could use https://www.drupal.org/project/file_mdm for this, the imagemagick module does the same.

dieterholvoet’s picture

Status: Active » Needs review

Tested this on one of my sites, + this approach is also being used in the Bunny Optimizer module. @RobinHoutevelts, can you let me know you approve of this approach and maybe test it on one of your sites?

dieterholvoet’s picture

  • DieterHolvoet committed 796c0949 on 2.x
    Issue #3257563 by DieterHolvoet, Robin.Houtevelts: Add caching mechanism...
dieterholvoet’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.