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

Fall back image #81

Closed
jakefuller1 opened this issue May 2, 2021 · 2 comments
Closed

Fall back image #81

jakefuller1 opened this issue May 2, 2021 · 2 comments

Comments

@jakefuller1
Copy link

If you use a large image (6000 x 4000), the 'const widths' does optimize images into smaller sizes and various formats.
However, the large image is used for fall back image (img src="too-large-image.jpg). This not ideal. Starting with small image and upscaling, not ideal.
Is there a way to use the smallest or second smallest 'constant widths' to generate the fall back image?
if (img.tagName == "IMG") in img-dim.js
Could I use img.getattribute("src") and then change image.jpg to image-608w.jpg? with img.setattribute("src")
Or is there a better way?

@cramforce
Copy link
Collaborator

Why do you say that using the large image as fallback isn't ideal?

@jakefuller1
Copy link
Author

The optimized images are 3K to 68K in size - 335 to 2010px wide. The fall back is 273K in size, 5184px wide. But "contain" will limit width but not file size. Original file size is 1734K.
Fallback probably shown by older browsers with slow internet? 1 to 2% of users?
2010px is 3x 670px - very high end mobile?
If fallback was -670w.jpg it would be 15K, instead of 273K

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

2 participants