realms-wiki
realms-wiki copied to clipboard
Uploading Images
Is there a way to allow users to upload images?
Currently no. There should be a feature to upload files.
This would be really useful, At the moment I'm planning on linking the wiki dir to owncloud to allow uploading of images by users but it would be good to have a simple image/media upload integrated into realms. Also really important to keep the links relative so the database can be ported to another site if necessary.
Hmm, I have come up with a method that works on gollum but fails on realms-wiki.
I created a shared folder inside the wiki folder: /images (which my users can access). The images are uploaded there and git commit is run (eventually I'd have incron watching this dir and running a git commit when a file changes)
Then in a page I insert:
Test3
[[images/test_image.jpg]]
OR
Test4

both of these work in gollum but not in realms, I also tried serving a local image by apache2 with this syntax, but it doesn't work either:
![alt text][test_img]
[test_img]: http://localhost/images/test_image.jpg "Title Text 2"
Yeah, that won't work. There is a static folder which is currently the only location where files will be served. It's possible to configure the web server to look inside of the git repo (wiki). I would have to give it some thought about the best way to do this.
cool, let me know if you need some testing, wondering whether a simlink into the static folder may work...
@zeigerpuppy It could but that isn't very flexible. The git repo could be anywhere so it would be up to the user to take action on the server and know what they are doing.
A better way would designate a dir in the repo... like media
and have flask treat it as static path. Using something like this: https://gist.github.com/rduplain/2758737
And even better, configure nginx/apache to handle that path rather than flask.
that sounds like a more robust solution. out of interest, is there any way that local links may work at the moment, I know it would be a hack but my users are struggling with the linking scheme for images that I have suggested to them!
This particular feature could also be implemented in a bit of a twist; let me explain what my use-case would be:
- I have a ZFS storage backend with family photos.
- I'd like to be able to publish "wiki pages" / "articles" and link to those images (but not have to upload them anywhere)
Obviously they would have to be served up somehow; they can be currently accessed over WebDAV (authenticated). It would be better however if realms-wiki reverse-proxied to the image storage so the "images" are not really publically accessible; except through the realms-wiki proxy (if this was further locked down that would be even better).
Thoughts?
I just submitted a Pull Request(#214) which solves some of the problems above, namely serving files that are already in the Git repository (however they got there). But I'd like to go further than that and make the actual uploading of images on the editing page possible. I need this to use this wiki as a productive wiki for our Hackerspace which also has some not that technical users that want to be able to edit content from the web interface.
So I'd like to propose how this might work in realms:
- When a user uploads a file it gets put in a subfolder with the pages name
- When you open the edit page there would be some sort of button which would list all files in the pages upload directory
- When you click such a file it would insert a markdown link to the file in the editor
- If the file is an image there either would be a second insert method or it would always add an image file
How do you guys feel about that before I start on implementing any of the above functionality? Any suggestions on how this could be made even better?
I'd very much like to see a way to upload images (or pdfs) to realms.
Another possibility would be to upload all images to a shared images/media subdirectory. That would work better for cases where images are moved between pages sometimes and there aren't too many images to start with.