Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image size schema management by third party client/frontend #11011

Closed
4 tasks
naz opened this issue Aug 13, 2019 · 2 comments
Closed
4 tasks

Image size schema management by third party client/frontend #11011

naz opened this issue Aug 13, 2019 · 2 comments
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

Comments

@naz
Copy link
Contributor

naz commented Aug 13, 2019

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

Unknown: How will this work with a headless front-end eg. Gatsby?

Context

Currently available image size schemas are configured through theme configuration (config.image_sizes property in package.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:

settings: {
    title: "Ghost",
    description: "The professional publishing platform",
    image_sizes: {
        amp_publisher_logo: {
            "width": 600,
            "height": 60,
            "type": "core"
        },
        amp_feature_image: {
            "width": 600,
            "height": 400,
            "type": "core"
        }
	}
	// all the other already available fields
}

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:

References

Previously available image resizing functionality - #10181

@naz naz added affects:admin Anything relating to Ghost Admin server / core Issues relating to the server or core of Ghost affects:api Affects the Ghost API admin-api labels Aug 13, 2019
@stale
Copy link

stale bot commented Nov 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale [triage] Issues that were closed to to lack of traction label Nov 11, 2019
@naz naz removed the stale [triage] Issues that were closed to to lack of traction label Nov 12, 2019
@stale
Copy link

stale bot commented Feb 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale [triage] Issues that were closed to to lack of traction label Feb 10, 2020
@stale stale bot closed this as completed Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant