rdunk / sanity-blocks-vue-component

[DEPRECATED] Vue component for rendering block content from Sanity
MIT License
71 stars 10 forks source link

Getting additional metadata image component? #23

Open sjsd opened 3 years ago

sjsd commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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.