Skip to content
This repository was archived by the owner on Aug 18, 2023. It is now read-only.

Getting additional metadata image component? #23

Open
sjsd opened this issue Jun 4, 2021 · 2 comments
Open

Getting additional metadata image component? #23

sjsd opened this issue Jun 4, 2021 · 2 comments

Comments

@sjsd
Copy link

sjsd commented Jun 4, 2021

I have photos in PortableText in Sanity. I have created a component that handles lazy load and creates a placeholder that is displayed while the image loads.

To make the placeholder have the same size as the image, I need metadata from the image. I can do this if I create my own image field. But when the image is inserted into PortableText and via the sanity-blocks-vue component, I do not get sent with parameters so I can get this metadata.

Is it possible to get the sanity-blocks-vue component to retrieve metadata about the image? If so, how do I do it?

@rdunk
Copy link
Owner

rdunk commented Jun 7, 2021

Hi @sjsd, which version of this plugin and Vue are you using?

Could you also to share an example of the portable text you are using, or any other code examples that might be useful.

@sjsd
Copy link
Author

sjsd commented Jun 7, 2021

I have dug a little more into the setup and see that the solution with Gridsome (which is the static page generator I use) and Sanity comes using Vue 2 and that it is version 0.1.0 that is used by sanity-blocks-vue-component.

I do not notice that it was such an old version and that 1.0.1 is for Vue 3. I assume I can use the legacy version. But am unsure what the imageOptions object should look like.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants