Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Srcset not fetching all values for named transform #69

Closed
anita-chouhan opened this issue Jun 28, 2024 · 6 comments
Closed

Srcset not fetching all values for named transform #69

anita-chouhan opened this issue Jun 28, 2024 · 6 comments

Comments

@anita-chouhan
Copy link

anita-chouhan commented Jun 28, 2024

Hi, I am trying to generate image transforms using a named transform but it's not working as expected.

Steps to repoduce

Add a named transform to imager-x-transforms.php:

return [
      'banner' => [
        'transforms' => [
            ['width' => 600],
            ['width' => 1200],
            ['width' => 1800],
        ],
    ],
];

Try to use it in retconSrcset

{{ entry.body|retconSrcset([
    'banner',
    {width: 400},
]) }}

Expected Output

<img src="../path/image.jpg" srcset="../path/image_W600.jpg 600w, ../path/image_W1200.jpg 1200w, ../path/image_W1800.jpg 1800w, ../path/image_W400.jpg 400w">

Actual Output

<img src="../path/image.jpg" srcset="../path/image_W600.jpg 600w, ./path/image_W400.jpg 400w">

Additional info

Retcon version: 2.7.5
Craft version: 4.9.7
PHP version: 8.0.2

@mmikkel
Copy link
Owner

mmikkel commented Jun 28, 2024

Thanks for reporting that. I just tagged Retcon 2.8.0 and 3.2.0 with a fix, for Craft 4 and Craft 5 respectively.

@anita-chouhan
Copy link
Author

Thank you for the quick turnaround. The named transforms are now functioning perfectly.

@bymayo
Copy link

bymayo commented Jul 3, 2024

@mmikkel Since this update we now get this issue

CleanShot 2024-07-03 at 14 42 35

We don't seem to be using the retconSrcset filter at all, but we do have ImagerX installed

@mmikkel
Copy link
Owner

mmikkel commented Jul 3, 2024

@mmikkel Since this update we now get this issue

Sorry about that @bymayo. What's your Craft CMS and PHP version?

mmikkel added a commit that referenced this issue Jul 3, 2024
@mmikkel
Copy link
Owner

mmikkel commented Jul 3, 2024

@bymayo That was a PHP 7 compatibility issue that was obvious as soon as I plugged in my brain 🙃 Just tagged Retcon 2.8.1 for Craft 3.x and 4.x with a fix.

@bymayo
Copy link

bymayo commented Jul 4, 2024

@mmikkel Amazing! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants