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

Is there any reason you don't add a height attribute to fallback image? #78

Open
ktallafus opened this issue Mar 6, 2021 · 3 comments
Labels

Comments

@ktallafus
Copy link

$fallbackTag->addAttribute('width', $referenceWidth);

You could also do
$fallbackTag->addAttribute('height', $fallbackImage->getProperty('height'));
like it's done in f:media. Or am I missing something?

@s2b
Copy link
Collaborator

s2b commented Mar 7, 2021

I think the reason for this was that the height value will be incorrect in most cases. By definition, the different sources of a picture tag will have different aspect ratios, so there can‘t be a correct height.

It can be argued that I should just choose the height of one variant or the one of the fallback image, but I‘m not sure what to choose here. Apart from that it would probably be a breaking change...

There probably will be a solution to that problem in the HTML5 specification:

https://twitter.com/jensimmons/status/1365066057774493697

@bernhardberger
Copy link

bernhardberger commented Sep 10, 2021

Btw. the viewhelper is broken when you use an image that doesn't have a width in sys_file_metadata (which can be the case when you're trying to use a file that isn't in your file storage but a static resource from your /Resources/Public/Images folder..)

@s2b
Copy link
Collaborator

s2b commented Sep 13, 2021

Could you give me a concrete example? This worked for me:

<sms:image
    src="EXT:sms_responsive_images/Documentation/Images/AdministratorManual/ConstantsEditor.png"
    srcset="200, 400, 600"
    width="400"
/>

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

No branches or pull requests

3 participants