Rerolled for 10.1.x / 11.x
Note that the above patch applies on top of #10
I've been using class names as service id before 9.5 and it used to work, but I've made a mistake: this won't work with Drupal 9 at all due to the '@.inner' notation, which got introduced in Symfony 5.1, so only available from Drupal 10.0 onward.
Attached, a patch using the syntax supported by both Drupal 9 and Drupal 10. I tried it on a Drupal 9.3 fresh install, and the service could properly be registered this time. Sorry for the mistake.
According to https://www.drupal.org/docs/getting-started/system-requirements/php-requ... → , Drupal 9.5 is no longer marked as compatible with PHP 7, and supports PHP 8.0 & 8.1.
Nevertheless, the attached patch should be compatible with PHP 7.4, and I removed the strict types check.
Hi, attached a patch inspired by the above MR, using a service decorator, available only if stage file proxy is installed, and works on the first request.
Supports stage file proxy >= 2.0.3, as the decorated service was introduced in the version.
About your remark in the previous comment "I'm guessing that this piece of code will need some extra checking for stage_file_proxy to fetch the original image before proceeding.": this is the case, the event subscriber fires and fetches the image before the drimage controller comes into play
Thank you @chetan, that was already done in the merge request.