Skip to content

Commit 1db87e9

Browse files
committed
Add assets endpoint to api reference
1 parent 0e26b01 commit 1db87e9

File tree

4 files changed

+755
-133
lines changed

4 files changed

+755
-133
lines changed

.vuepress/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ module.exports = {
115115
["/api/authentication", "Authentication"],
116116
["/api/items", "Items"],
117117
["/api/files", "Files"],
118+
["/api/assets", "Assets (Thumbnails)"],
118119
["/api/activity", "Activity"],
119120
["/api/collections", "Collections"],
120121
["/api/collection-presets", "Collection Presets"],

api/assets.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
pageClass: page-reference
3+
---
4+
5+
# Assets (Thumbnails)
6+
7+
<two-up>
8+
9+
::: slot left
10+
Image typed files can be dynamically resized and transformed to fit any need.
11+
:::
12+
13+
<info-box title="Endpoints" slot="right">
14+
15+
```endpoints
16+
GET /:project/assets/:key
17+
```
18+
19+
</info-box>
20+
</two-up>
21+
22+
---
23+
24+
## Get an asset
25+
26+
<two-up>
27+
<template slot="left">
28+
29+
Get a resized file. Files are resized on demand.
30+
31+
### Parameters
32+
33+
<def-list>
34+
35+
!!! include params/project.md !!!
36+
37+
#### key <def-type alert>required</def-type>
38+
`private_hash` of the file.
39+
40+
</def-list>
41+
42+
### Query
43+
44+
<def-list>
45+
46+
#### key <def-type>optional</def-type>
47+
The key of the asset size configured in settings.
48+
49+
#### w <def-type>optional</def-type>
50+
Width of the file in pixels.
51+
52+
#### h <def-type>optional</def-type>
53+
Height of the file in pixels.
54+
55+
#### f <def-type>optional</def-type>
56+
Fit. One of `crop`, `contain`.
57+
58+
#### q <def-type>optional</def-type>
59+
Quality of compression. Number between 1 and 100.
60+
61+
</def-list>
62+
63+
If you're using `key`, you don't need to specify any of the other query parameters. If you're using `w`, `h`, or any of the others, you're required to provide them all. This allows Directus to match it against the whitelist in settings. If you have the whitelist turned off completely, any combination is allowed.
64+
65+
</template>
66+
<template slot="right">
67+
<div class="sticky">
68+
<info-box title="Endpoint">
69+
70+
```endpoints
71+
GET /:project/assets/:key
72+
```
73+
74+
</info-box>
75+
76+
</div>
77+
</template>
78+
</two-up>
79+
80+
---

guides/user-guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ The file library is an annex of all files added to Directus. Files may be added
285285

286286
Directus also supports multiple [storage adapters](../extensions/storage-adapters.md), so you may have the option to save files to different locations.
287287

288-
There's also an automatic [thumbnailer](./thumbnailer.md) included, so you can easily save your original files at different sizes. Allowed thumbnail sizes are setup by your administrator.
288+
There's also an automatic [thumbnailer](./files.md) included, so you can easily save your original files at different sizes. Allowed thumbnail sizes are setup by your administrator.
289289

290290
By default the File Library displays as a Card layout with thumbnails, but you can change this in the [Info Sidebar](#info-sidebar).
291291

0 commit comments

Comments
 (0)