Cosmic
September 10, 2024
Media Updates
We've got a big release to share with you. The focus of this release is media features and improvements including a new Multi Media Metafield, alt text, image cropping, and more.
Multi Media Metafield
The Multi Media Metafield is a new way to add multiple files to your Objects. Included for free on all accounts today, it enables you to upload multiple files at once, create image galleries, set validation, reorder, and more.
How to use it
-
Go to any new or existing Object type settings page and find the Multi Media Metafield and add it to your Metafields model.
-
Upload or select multiple media files to add to your Object and save.
-
The response from the API will be an array of objects on the key that you set for the Metafield. For example:
See the Objects section in the docs for more technical information.
Alt text
Alt text in now available on all images. This is a convenient way to ensure the images on your website are conforming to standard web accessibility best practices.
Adding alt text
To enable alt text, go to any image type media and click to open the info modal. Find the alt text, enter a description, and save.
Getting alt text from the API
You can get the alt text from the API using the media endpoint or Cosmic JavaScript SDK ( or methods) querying by media . For example:
You can also batch find alt text using the and query operator.
See the media section in the docs for more information on how to use the media API endpoints.
We are also working on the ability to set options on the Cosmic JavaScript SDK to provide the alt text values (as well as other media data) directly on the Objects JSON response. See the draft PR for more information on how this will work.
Image cropper
Other improvements and fixes
- Improvement: Select Objects drawer now shows number selected.
- Fix: Removed the wheel scroll on number fields.
- Fix: Rich text toolbar no longer breaking on mobile.
- Improvement: You can now add folder from upload tab on the media modal.
- Improvement: You can now download media from the media metafield.
- Improvement: The add selected and search toolbar is now sticky on the media modal library to give you easier access.
- Fix: Docx files no longer automatically downloaded when viewing in the media modal.
- Fix: Video thumbnails on Safari are now appearing properly.
- Improvement: Docs nows includes a dedicated page for Metafields and Metadata usage information.
Log in to the Cosmic dashboard to begin using these new media features.