Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Using custom image preview paths #184

Open
@dave-db

Description

@dave-db

For various (near-unspeakable) reasons, I'm using a remote git instance as a CMS backend (in a similar vein to how Netlify CMS does). Changes are made on new branches, each save is a commit, reviews are handled with PRs etc. Image uploads have been thorny - because only images on master are actually deployed to the live site, uploading an image to the current edit's branch means it can't readily be viewed (as it's not deployed on the same instance as the active site). Netlify gets around this by immediately uploading all images to master, but that's not an option for me thanks to the aforementioned review process.

It's possible to read the image directly from the CMS, though, the moment it's uploaded, and a quick tweak of the image path means you can change a reference from:

/static/images/uploaded.png

to

https://git-server/project/raw/static/images/uploaded.png?at=refs/heads/branchname

Ideally, I'd use the getLinkComponent prop to handle this like an Embed - detect an image/image path, do a quick inline replace for rendering purposes, but crucially leave the underlying source unaffected (as once the change merges, the first path will be correct).

Would there be some way to override image preview behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions