🔥 Use Directus Storage Assets Presets only for images

Block the generation of other image sizes from the URL

TODO: Block the access to root asset url as it still displays the original file
This commit is contained in:
2021-10-17 22:17:52 +02:00
parent 56857fe30d
commit f29b4c3bb0
10 changed files with 103 additions and 47 deletions

View File

@@ -19,4 +19,15 @@ export const getAssetUrl = (
if (format) args += `&format=${format}`
return `${API_URL}/assets/${id}?width=${width}&height=${height}&fit=${fit}${args}`
}
/**
* Get a Directus asset URL from parameters
*/
export const getAssetUrlKey = (
id: string,
key: string
) => {
return `${API_URL}/assets/${id}?key=${key}`
}