Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Last active January 21, 2018 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerodsanto/5d9aff440101870308942dee8b0b092b to your computer and use it in GitHub Desktop.
Save jerodsanto/5d9aff440101870308942dee8b0b092b to your computer and use it in GitHub Desktop.
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