Image size schema management by third party client/frontend #11011
Labels
affects:admin
Anything relating to Ghost Admin
affects:api
Affects the Ghost API
server / core
Issues relating to the server or core of Ghost
stale
[triage] Issues that were closed to to lack of traction
Problem
Image size schema management and consumption is not possible by third party client/frontend.
This problem was raised initially as a question in #10181
Context
Currently available image size schemas are configured through theme configuration (
config.image_sizes
property inpackage.json
) as specced in #10181.The problem with keeping configuration solely on the frontend (theme layer) - it doesn't allow the backend to behave in an independent "headless" way.
Technical solution
Image sizes will become a part of settings and live under a new image_sizes key. There will be 3 internal types introduced: core, api and theme.
Use cases for each type:
core - immutable, predefined sizes. The API will throw an error when they are being modified. Allows to have a set of sizes that can be always relied upon by Integrations or other clients
api - mutable sizes defined through API
themes - api-like type. It's purpose: to be able to flush out theme configs when a new theme is activated. We would want this to prevent unnecessary data piling up in the configs while not having a UI for image config manipulation. When the theme changes its image_configs are loaded, old ones are removed and any of the conflicting with core or api are skipped.
For current needs, only 2 core sizes will be introduced: amp_publisher_logo and amp_feature_image.
Implementation Details
Ghost API will expose all available image sizes through Content API for clients to consume as well as allow defining new custom sizes through Admin API.
An example format served from Content API (
GET /api/v2/content/settings
) will have the following form:Specification for editing image sizes through Admin API is int the works. It will ultimately allow having a clear way for themes or any other API client to put custom image sizes, so resized images can be served later through
content/images/size/....
endpoint.Tasks:
img_url
helper and accepted in/content/image/size/{dimension}/requested.png
URLsReferences
Previously available image resizing functionality - #10181
The text was updated successfully, but these errors were encountered: