You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns a random image. Supports flexible parameter combinations for different use cases.
187
+
Returns a random image. By default it responds with a 302 redirect to the absolute URL of the real image file. The random API entry itself is not cached, while `/image/images/...` static image files are suitable for CDN caching. Image API responses and final static image responses include `Access-Control-Allow-Origin: *` for theme integrations and cross-origin image loading.
187
188
188
189
| Parameter | Values | Default | Description |
189
190
|-----------|--------|---------|-------------|
190
191
| `gallery` | Gallery name | All | Target gallery |
`device`has higher priority than `type`. For example, `/image/api/random?device=mobile&type=mobile` selects a portrait mobile image and uses the default 302 redirect response. Unknown `type` values are ignored and treated as the default `redirect` mode.
Accessing `/image/api/random` is equivalent to `/image/api/random?type=redirect`. Use `?type=image` for raw image binary, `?type=json` for metadata JSON, or `?type=redirect` for an explicit redirect response.
206
+
207
+
**Caching and CORS:**
208
+
209
+
- `/image/api/...` responses use `Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate`
210
+
- `/image/images/...` static image files use `Cache-Control: public, max-age=31536000, immutable`
211
+
- Image APIs, 302 responses, and static image responses include `Access-Control-Allow-Origin: *`
201
212
202
213
**JSON response example:**
203
214
@@ -219,11 +230,14 @@ Returns a random image. Supports flexible parameter combinations for different u
219
230
220
231
| Endpoint | Use Case |
221
232
|----------|----------|
222
-
| `GET /image/api/random` | Random image from any gallery, ideal for site-wide random backgrounds |
233
+
| `GET /image/api/random` | Default 302 redirect to a real image file, ideal for CDN-backed random backgrounds |
223
234
| `GET /image/api/random?gallery=anime` | Random image from a specific gallery, ideal for category-based wallpaper rotation |
0 commit comments