[dokuwiki] Re: Media/image files, isn't there a simpler way?

  • From: Michiel Kamermans <pomax@xxxxxxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 16 Aug 2010 13:33:19 -0700

Chris,

If I upload the file image.png to <dokuwiki_home>/data/media directory what's the correct link to refer to it? I tried this and couldn't get it to work properly. There's no explanation in the dokuwiki documentation (that I can see anyway) that tells you how a {{<something>}} image link is actually interpreted. For a start it appears in the browser address bar with _media rather than just media and then, in addition, it seems to add some/all of the namespace that the reference is from.

If you place "image.png" in the /data/media directory, you refer to it using {{image.png}}. If you want to use an explicit namespace, the base media location would be {{:image.png}}, and because namespaces are just directories, you could place the image in /data/media/mytopic/moo/image.png and then refer to it as {{mytopic:moo:image.png}}.

On dokuwiki pages you don't put in any absolute links to the files, you put in a dokuwiki media indicator. However, if you wish to point to the file from some external site (but I can't really think of why you would do so...) the base URL looks like www.yourdokusite.com/lib/exe/fetch.php?cache=&media=myimage.png

You can mask this URL so that it's less obvious that the image is being served by dokuwiki, by telling your server (either in its config or via htaccess) to use a rewrite rule so that /images/(filename) is turned into /lib/exe/fetch.php?cache=&media=(filename) internally instead. This makes for cleaner URLs and links, but is purely cosmetic. Dokuwiki will still fetch that image through its fetch.php script.

- Mike
--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: