-
Notifications
You must be signed in to change notification settings - Fork 12
Support image uploads to a default directory from the admin interface #18
Conversation
http://blog.alexmaccaw.com/svbtle-image-uploading Svbtle is ahead of the game, obviously. :) |
I've been trying to think about different approaches to this, looking for something sensible. One idea:
All images for a given post will then be in the same month folder, no matter when the image was added, so you can find a file quite easily if you know the post it's used in. This also makes finding orphans easier, I suppose? That feels too complex, though. Especially with the move. An uploaded file's path should be independent of publish status. Plus, a file could be reused across many posts. Simpler:
This seems better, but then two images might be in separate month folders even if they're used on the same post, so the hierarchy is pointless, and would affect finding orphans. No hierarchy, include the post slug in the name:
This looks reasonable enough, although if post permalinks are Makes it harder to go hunting for images, but do we care? The file system would have timestamps, so probably not? The slug might change, and if it's an initial draft then there is no slug. Maybe there could be user interaction? User interaction:
The name would get sanitised, but this makes it much less magical. Or, the minimal approach:
This is basically how GitHub does it. I guess it's fine, although there is a total lack of some kind of user-friendly structure. Paranoia. 👻 Instead of a timestamp, it should be something suitably harder to guess. |
d0de2cb adds this functionality to all admin textareas. It adds the handler to The file format is Some things I need to consider:
|
This also constructs the entire path client-side to be used by the application.
Conflicts: statics/templates/admin/layout.liquid
Support image uploads to a default directory from the admin interface
It would be great to be able to upload images from within the admin editing interface. Inspiration can probably be taken from the way GitHub issue attachments work.
The default upload directory can be something like
/files/<year>/<month>/<name>
, but configurable.Thoughts:
files/
to browse stuff outside of the editing interface?