Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@coreyward/sanity-plugin-media
Advanced tools
![npm-v](https://img.shields.io/npm/v/sanity-plugin-media?style=flat-square) ![npm-dw](https://img.shields.io/npm/dw/sanity-plugin-media?style=flat-square)
A convenient way to browse, manage and refine your Sanity assets.
Use it standalone as a browser, or optionally hook it up as a custom asset source and use it to power asset selection too.
title
, description
, altText
and originalFilename
In your Sanity project folder:
sanity install media
This will add the Media button to your studio menu. If this is all you're after – that's all you need to do!
You'll need to do this if you want to use the plugin when selecting images.
This plugin exposes part:sanity-plugin-media/asset-source
which you import when defining custom asset sources.
In sanity.json
, add the following snippet to the parts
array:
{
"implements": "part:@sanity/form-builder/input/image/asset-sources",
"path": "./parts/assetSources.js"
}
In ./parts/assetSources.js
:
import MediaAssetSource from 'part:sanity-plugin-media/asset-source'
export default [MediaAssetSource]
That's it! The browser will now pop up every time you try select an image.
file
fields.opt.media.tags
on assets aren't accessible via GraphQL. This is because opt
is a custom object used by this plugin and not part of Sanity's asset schema.sanity.imageAsset
or sanity.fileAsset
fields
property when defining your document schema (on both image and file objects). Values that you define in the fields
property can be considered 'local', or bound to the the document where that asset is linked.fields
property in your document schema's file/image fieldThe following GROQ query will return an image with additional asset text fields as well as an array of tag names.
Note that tags are namespaced within opt.media
and tag names are accessed via the current
property (as they're defined as slugs on the tag.media
document schema).
*[_id == 'my-document-id'] {
image {
asset->{
_ref,
_type,
altText,
description,
"tags": opt.media.tags[]->name.current,
title
}
}
}
media.tag
opt.media
title
, description
and altText
which are stored directly on the asset as they're part of Sanity's defined asset schemamedia.tag
document type in your definitionsanity.imageAsset
or sanity.fileAsset
?image/*
will be uploaded as sanity.imageAsset
, everything else will be treated as sanity.fileAsset
sanity.fileAsset
via the plugin. In the rare case that you do need images to be treated as files, consider uploading them outside of the pluginContributions, issues and feature requests are welcome!
MIT. See license
FAQs
![npm-v](https://img.shields.io/npm/v/sanity-plugin-media?style=flat-square) ![npm-dw](https://img.shields.io/npm/dw/sanity-plugin-media?style=flat-square)
We found that @coreyward/sanity-plugin-media demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.