Image dimensions metadata on google-cloud-storage.

2019-08-19 08:21发布

问题:

I need to know the dimensions of images I'm saving, so that I can add them to the og:image:width and og:image:height meta tags for image previewing by Facebook, Twitter etc - as is suggested by this Facebook documentation.

If I'm saving these images to a google storage bucket - is there any already existing way of finding these images sizes with existing standard metadata, or will I need to add some custom metadata as described in this google documentation?

回答1:

Given that Cloud Storage sees everything as objects, it does not have multiple object definitions, depending on the type of the object (like media, text... it does something like this via Content-Type but it's not what you're looking for). In this sense, there are no object type characteristic-metadata (i.e. width and height of images or length for sounds or videos).

The only predefined (or how you call it, standard) metadata entries are the ones mentioned here and, yes, as you specified, you need to add custom metadata.