piperhaywood / ephemera.sambaldwin.info

ephemera-web-piper.vercel.app
3 stars 1 forks source link

Trouble uploading images in Sanity Studio #13

Open piperhaywood opened 2 years ago

piperhaywood commented 2 years ago

So I was running in to a lot of issues uploading images in Sanity Studio. Couldn’t upload in a single image field, could upload by dragging in to an array of images.

Raised it in the Sanity Slack and got some great help from Geoff. Link for posterity:

https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1646235294796039

This was the end of the convo:

[Geoff](https://app.slack.com/team/U02ATEEQ8HY):sanity:  [1 day ago](https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1646677464123209?thread_ts=1646235294.796039&cid=C9Z7RC3V1)
Hi Piper. Thanks for your patience. Could you try removing dimensions, hasAlpha, and isOpaque from your metadata array? They aren’t [valid values](https://www.sanity.io/docs/image-type#metadata-5fe564e516d8) and I suspect they’re causing the problem. If that still doesn’t work after restarting your studio process, please let me know.
ticket
white_check_mark
raised_hands

[Geoff](https://app.slack.com/team/U02ATEEQ8HY):sanity:  [1 day ago](https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1646689473928569?thread_ts=1646235294.796039&cid=C9Z7RC3V1)
Interesting. [This page](https://www.sanity.io/docs/image-metadata) says they can be defined. I’m checking to see if something changed and this page is now out-of-sync. In the meantime, I’d still encourage you to try removing them from your array to see if it helps.

[Geoff](https://app.slack.com/team/U02ATEEQ8HY):sanity:  [6 hours ago](https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1646752697574609?thread_ts=1646235294.796039&cid=C9Z7RC3V1)
[v2.28.0](https://github.com/sanity-io/sanity/releases/tag/v2.28.0) contains some improvements to how you experience the metadata array. If you specify any of those three strings in your array that previously threw an error, they will now be quietly removed. The docs have also been updated to better represent what the array expects. Hope this helps!

[piper](https://app.slack.com/team/UB5MECA15)  [2 minutes ago](https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1646775811983399?thread_ts=1646235294.796039&cid=C9Z7RC3V1)
That’s great, thanks so much [@Geoff](https://sanity-io-land.slack.com/team/U02ATEEQ8HY)! I really appreciate it!

So seems like it may have been a documentation issue. Two fixes would be to upgrade Sanity Studio to v2.28.0 (this would prevent error), but also remove the invalid metadata attributes from the image field.