Open hvelarde opened 8 years ago
@hvelarde I think if src="resolveuid/979bede6b93e46d386be493d852ed744" then we can use
with Image.open(src) as img:
height,width=im.size ```
and we need to import PIL
and one more option we have is by numpy
Oh...never mind
I think this will need to partially request the external image and guessing its dimensions; but we need to be careful to not download the whole file as it can be big and will keep a thread busy until is done..
Height and width are just to know the aspect ratio of the image. We can do one thing set any default values for height and width so that it fits every image and add layout ="responsive" You must see this https://stackoverflow.com/questions/42220861/how-to-deal-with-images-with-an-undefined-height-and-width-attribute-for-amp-pag @hvelarde
we can't do that if we don't know the real aspect ratio; we still need to read a chunk of the image for that.
When transforming an
<img>
tag into a<amp-img>
we need to provide size information and remove any class attribute; we need to think how to solve this without adding too much complexity to the package.