Skip to content

Added if statement to check if thumbnails are set #30

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

Closed
wants to merge 3 commits into from
Closed

Added if statement to check if thumbnails are set #30

wants to merge 3 commits into from

Conversation

jesse-deboer
Copy link

This change will solve a bug that will happen when there is no first.width available.

The code will now add one image in the src-set with 1w, which does not work in Safari on the iPad and with this change it will not add any src-set if there are no images available to put in there.

This change will solve a bug that will happen when there is no `first.width` available. 

The code will now add one image in the `src-set` with `1w,` which does not work in Safari on the iPad and with this change it will not add any `src-set` if there are no images available to put in there.
@tinect
Copy link
Member

tinect commented Nov 12, 2021

Hi @jesse-deboer
how can the width be not available? Iirc, thumbnails are always based on width and height.

Edit: oh, I see.
This happens when the filter before result into an empty list.

Could please check for thumbnails has content instead and adjust the check in line 45? So, a reader has more context for understanding.

Updated to only get a `src-set` when there are thumbnails set
@jesse-deboer
Copy link
Author

I updated it!

It gives you an empty list when the metaData.width is smaller than the v.width because the filter won't get any values

@jesse-deboer
Copy link
Author

Also updated line 45 now 😄

@jesse-deboer jesse-deboer changed the title Added if statement for first.width Added if statement to check if thumbnails are set Nov 12, 2021
@tinect
Copy link
Member

tinect commented Nov 13, 2021

Also updated line 45 now 😄

Thank you. But line 45 is one line above. In your current way, there would be 3 more useless attributes set.

https://github.com/FriendsOfShopware/FroshPlatformThumbnailProcessor/pull/30/files#diff-902f09bb96e2c21965cf4b3e2affebe058357695c767cc97945146c6761e5d41R45

@tinect tinect closed this in 2849de5 Nov 22, 2021
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

Successfully merging this pull request may close these issues.

2 participants