streamline responsive_image_build_source_attributes()

Created on 10 February 2015, over 9 years ago
Updated 8 February 2023, over 1 year ago

Follow-up to #2260061: Responsive image module does not support sizes/picture polyfill 2.2 →

- Adjusts theme('responsive_image') to require the caller to provide a 'width' and 'height', like theme('image_style') does. The 95% use case caller (the image field formatter) passes the dimensions anyway (the Imageitem has them).
This improves consistency bewteen responsive and non-responsive styles.

- Improves perf by removing the code that repeatedly reads the dimensions from the file. We stopped doing that in D7 (IIRC) for image styles for performance (reading dimensions on each output can be nastly if the file is not local ?)
Also, removes the need to create an ImageInterface object for the file altogether.

- As a side effect, strramlines a bit the logic between template_preprocess_responsive_image_formatter() responsive_image_build_source_attributes() and how they work together.

- Adjusts the phpdoc for responsive_image_build_source_attributes() accordingly, and fixes a couple nits while we're in there :-)

Beta phase evaluation

<!--Uncomment the relevant rows for the issue. -->

Original report by [username]

I think we can still streamline responsive_image_build_source_attributes() a bit, but this can totally happen in a followup.

This needs a bit more information ;-)

📌 Task
Status

Needs review

Version

10.1 ✨

Component
Responsive image  →

Last updated 12 days ago

Created by

🇧🇪Belgium attiks

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024