Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Changelog Admin Feature: Add Images by URL

Description

Many objects in Changelog's system have attachable images. People have avatars. Sponsors have logos. Topics have icons. Etc.

Currently, we attach images by downloading them to our machines and then uploading them via a file input on the forms. An example form:

This is fine, but many times the images already exist on the web somewhere.

We want to augment these forms to optionally accept an image URL instead of an image file. If a URL is provided, its image will be fetched and used just as if it was uploaded via the file input. All image processing/transformation should continue to work like normal.

Notes

  • Our file attachments rely upon the excellent Arc (and Arc Ecto) libraries.
  • This Arc issue has some discussion on how the library can be used in such a manner
  • All Arc-related modules use Changelog.file, so it's a good place for shared functionality
  • Modules with image attachments: Person, Sponsor, Topic, NewsItem, NewsSource, NewsAd
  • A basic implementation on one module/form which can be generalized to other scenarios would be a great start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.