Problem/Motivation

I'm trying this module for the first time but no images are getting rendered and there is a 404 for each image style. Using the breakpoint debugger I can see that in onKernelRequest in the section that explodes the $path into $style_parts the $width and $height aren't pointing to the correct $style_parts.

This is because it fails to take into account the image style name is drimage_improved which explodes into two parts drimage and improved. So when it looks for $width at $style_parts[1] it is finding improved and not the actual width.

I'm confused how this is working at all for people?

screenshot of the parts

Steps to reproduce

Use the module normally and add a breakpoint on line 113 of DrimageSubscriber.php

Notice the $style_parts in the debugger as you step through. Also note how the wrong values are added for the $width and $height.

Proposed resolution

Increment the array index to take into account the extra array item.

Remaining tasks

  • ✅ File an issue
  • ➖ Addition/Change/Update/Fix
  • ➖ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ➖ Readability
  • ➖ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Documentation
  • ➖ Code review by maintainers
  • ➖ Full testing and approval
  • ➖ Credit contributors
  • ➖ Review with the product owner
  • ➖ Release notes snippet
  • ❌ Release

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
CommentFileSizeAuthor
Screenshot_20250811_154137.jpeg31.83 KBtanc
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

tanc created an issue. See original summary.

tanc’s picture

A solution could be to remove that part of the array, like:

      // Remove the 'improved' part from $style_parts and re-index.
      unset($style_parts[1]);
      $style_parts = array_values($style_parts);
rajab natshah’s picture

Thanks, Tancredi, for reporting and the Proposed fix
Let us create an MR to quick test then follow up with a quick fix release

tanc’s picture

I should probably note that this is a Drupal 11 site, in case that makes a difference

rajab natshah’s picture

Assigned: Unassigned » josebc
Status: Active » Needs review

Tancredi, thanks for the MR
For sure, to be tested in both Drupal 10 and Drupal 11

josebc’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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