Closed sohilpandya closed 8 years ago
@sohilpandya this is one of the trickier issues to solve. The ways you have described are good. The MVP is to hard-code the dimensions based on the devices viewing your content. But ... downloading the images and getting their dimensions is a good ("Hero") task for conscientious person to undertake this week.
@sohilpandya can this be closed now?
Yep.
We have run into an issue setting the width & height of an amp-img as these are not specified in the markdown, but are required for amp validation.
Our (tentative) solution is to load these images on the backend, retrieve the dimensions and then use these when building our amp compliant HTML.
A more simple way to solve this would be to parse the html while synchronously inferring img dimensions as we are passing through the html. A more complex solution would be to take two passes through the html; the first starting async request to find image dimensions and the second starting only after all the async requests are resolved. The second pass could then insert the image dimensions.
Very easy option is to hard code in a fixed width & height.
@jackcarlisle @des-des