scragg0x / realms-wiki

Git based wiki inspired by Gollum
http://realms.io
GNU General Public License v2.0
831 stars 90 forks source link

Uploading Images #68

Open agustaf9 opened 9 years ago

agustaf9 commented 9 years ago

Is there a way to allow users to upload images?

scragg0x commented 9 years ago

Currently no. There should be a feature to upload files.

zeigerpuppy commented 9 years ago

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.

zeigerpuppy commented 9 years ago

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
![Alt attribute text Here](images/test_image.jpg)

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"
scragg0x commented 9 years ago

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.

zeigerpuppy commented 9 years ago

cool, let me know if you need some testing, wondering whether a simlink into the static folder may work...

scragg0x commented 9 years ago

@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.

zeigerpuppy commented 9 years ago

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!

prologic commented 8 years ago

This particular feature could also be implemented in a bit of a twist; let me explain what my use-case would be:

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?

fabianthoma commented 6 years ago

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:

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?

larsimmisch commented 6 years ago

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.