User Tools

Site Tools


Sidebar

Namespace Root
Table of Contents

newsfeed

media

Tool bar icons and dialogs

In Dokuwiki uploading media files to the server and inserting images and external media urls are handled by the media manager; in addition, internal links can be set from a pop-up menu attached to the internal like tool bar item. In the FCKeditor, these features are handled by three dialogs modified in fckgLite to accommodate Dokuwiki. These are the image and link dialogs and the file browser.

The toolbar buttons which activate the link and image dialogs are the familiar Dokuwiki icons:

The link dialog has three fields, two of which are drop-down menus.

Leaving the Link Type as URL, you can choose either http or https from the Protocol menu and type your URL directly into the URL field. Links using the URL protocol are what Dokuwiki sees as external links, that is, links to addresses outside the Dokuwiki data directory. But if this were all you wanted, you could type your URL directly into the editor and Dokuwiki will pick it up and convert it to a valid link. The utility of this dialog are the options provided by the Link Type menu:

Samba Shares and email addresses

If you select E-Mail or SMB share, you type the address into the SMB Share or E-Mail field and click OK. In the case of email links, similar to URL 's, you can type the address directly into the editor, using Dokuwik markup; the Link dialog is not really necessary (see the “Creating Email Links” on the features page). For SMB shares, however, you must use the Link dialog and type the address in the SMB Share text-box: %server\share\file.<ext>. The share must have a file extension.

Internal links and links to files in the Dokuwiki media directory must be created using the Link dialog. Dokuwiki Internal Link is a link to a file in Dokuwiki's name-space hierarchy, while Non-Dokuwiki Internal Files are files which have been uploaded to Dokuwiki's media directory, pdf files, tarballs, etc. When you select one of these options, the Browse Server/Upload button will appear. Clicking this button will open the File Browser. In the case of internal links, it will open in the Dokuwiki data/pages/current_namespace directory; in the case of non-Dokuwiki internal files, it will open in the data/media/current_namespace directory.

When entering internal link names manually, instead of by means of the file browser, names which begin with a colon are assumed to have their origin in the woot wiki directory; name which do not begin with a colon are assumed to have their origin in the current directory. In the case of the latter, therefore, if you are in namespace_1 and enter new_file into the text box, fckgLite will create a link to :namespace_1:new_file. (Added Sep 2 2011)

Starting with distributions as of Nov 12 2010, the internal link dialog has facilities for adding query strings and attaching page anchors to urls, which in the HTML take the form of <a name='anchor_name'> and when clicked bring the user to the place in the page where the anchor has been inserted. In Dokuwiki page anchors are created from the h1-h5 page headers.

When you select the internal link option, an Advanced tab appears at the top of the dialog. Clicking on the Advanced tab will switch over to the following sub-dialog:

To insert a page anchor, you click on the “Get Headings' button, which creates a drop down menu of headers. Click on a header and an anchor will automatically be attached to your url.

With Dokuwiki distributions starting with 'Anteater” (Nov 11 2010), it is possible to insert query strings into your inernal link urls. This dialog enables that feature. Simply type your query string into the 'Query String” box and it will be attached the the link url.

Adobe Flash

 

You can load files with the .swf extension directly from the file browser. When first loaded into the editor, the filename will appear beside an Adobe flash file icon:

After the document is saved the movie will play. When the file is reloaded into the editor, the parser will recognize these files and convert the syntax to this form:

  • SWF namespace:swf_file.swf FWS

The SWF and FWS function like native Dokuwiki image markup and you can position your flash video by placing spaces on either side of the filename. You can also link to external .swf files:

It is not necessary to use the link tool for either of the two cases. You can enter this syntax directly into your document.

How to convert an internal link to an external link, using the link editor, is demonstrated here.

Links have two parts, the URL and the link text. When you create a link with the link dialog, the link text will be the same as the URL. So, if you create a link to :wiki:syntax, you will get :wiki:syntax. If instead, you would like syntax, you can achieve this in one of three ways.

  1. simply enter the standard Dokuwiki markup directly into the editor: [[:wiki:syntax|syntax]]
  2. enter the text syntax into the editor, select it with the mouse, and then open the link dialog and create the link using the dialog.
  3. create the link using the dialog and then edit the text after the link is created; in this case you would just remove :wiki:, and you will be left with syntax.

These techniques work with all types of links.

See :features

File Browser

The file browser is basically self-explanatory. At the top of the file browser, beside the large open folder icon. is the name of the current directory. At the top left is the “Resource type”, which in this case shows up as “Image”, since the file browser was accessed from the image dialog. Although it shows a drop-down menu, in the fckgLite implementation it is not possible to switch between types. Under the resource type is a listing of links to directories which are hierarchically at a level above or parallel with the current directory.

Moving and deleting files

Deleting

To delete a file, use the trash can.

Moving

A “Move” icon is found with the 'read-only' and 'uploadable' icons:

Holding down the Ctrl key and clicking on the trash can will open a dialog which will let you move the selected item to a subdirectory of the current directory. The item will be deleted from the current directory. Enter the name of the required subdirectory into the dialog's text box and click OK. It will accept nested subdirectories, for instance dir_a/dir_b/dir_c.1)

The default subdirectory name is “secure”, but you can change it to any other name. The reason for this default name is that you may want to create a “secure” folder for files that you don't want directly accessible from the web but only as allowed from within a Dokuwiki page. If you choose to keep the name “secret” the directory will automatically be secured with the following .htaccess file:

order allow,deny
deny from all

With this file in place, a direct ink to http://www.yourwiki.org/data/media/secure/secrets.txt will be denied access by the web server. But Dokuwiki will be able to create a link to 'secrets.txt' that can be accessed from any page for which a user has read permission.

See the discussion of security on Dokuwiki's plugin page for fckgLite. The new move facility makes it easy to upload files that will be consistent with Dokuwiki's naming code and then to simply move them over to your secure directory (and without having to re-open the filebrowser).

Read Only and Uploadable files

In the example above, the yellow folder icons in the directory listing indicate that the user has upload permission for all of the folders. Because the user has upload permission, the file names in the directory listing have trash cans to the left of the file names. Clicking on the trash can will delete the file.

Where the user does not have upload permission, the folder icon is blue:

In this example the user does not have upload permission for the playground directory, so there are no trash cans beside the file names. But because playground/test is identified by a yellow folder, the user does have upload (and delete) permission for that directory. Clicking on test or its yellow folder will switch the file browser listing to playground/test, which will show the trash cans beside its file listings.

Uploading Files and Creating Directories

The bottom panel of the file browser is used to upload files to the server. Click browse to find the file on your local computer, then click upload to send it to the server. The Create Folder button appears only if enabled by the administrator. If ACL is enabled, only users with upload permission for the current folder can create folders there.

Selecting a file

When you select a file from the file browser by clicking on its name, you will be immediately returned to the dialog window and the address of the file will appear in the address field.

 

Image Dialog

After selecting an image from the file browser, it appears in the preview pane in the position it will have in the editor with respect to the text. In this example the image is aligned to the middle and therefore appears at the middle of the preview above the text. You can also change the size of the image by changing width or height; if the lock is set, the changes will be proportional, if not you can change the width and height independently.

For more information about image alignment, see the features page.

Copy and Paste

Images can also be copied from other web sites and pasted directly into the editor. These images must have a valid image url. If the image is a thumbnail, the thumbnail sizing will be removed and when re-loaded the image will appear full size (as of 23 Jan 2014). This is necessary in order for the image to be recognized as such by the editor. It's possible to re-size the image before saving by using the Image Properties menu. You can also re-size after reloading the image into the editor.

Images can also be inserted from the clipboard, but they must be recognized as valid images by PHP. These cannot be re-sized until after they have been saved and reloaded into the editor. However, they can be horizontally aligned on the page. Images from the clipboard will always be assigned a type of nolink; this can be changed only after the page has been saved and re-loaded into the editor.

fckgLite supports Dokuwiki's link types. The default is “detail”. If you select “linkonly”, the image will appear on the page, but after the page is saved, it will be converted to a link only. If you prefer to have a link appear in the editor instead of the image, you can use the link dialog instead of the image dialog.

File Browser with Image viewing

As of November 19 2010, the file browser incorporates thumbnails and the capability to click on a thumbnail and get an image magnfication. As the illustration below shows, the magnification window has an 'insert into document' button, a convenience so that you don't have to scroll back down if you decide this is the image you want.

img_browser.jpg

Security and the media directory

By default Dokuwiki prevents anyone from directly accessing files in the data/media directory. What this means is that you cannot use a URL to fetch an image or file directly from the media directory. Links of this type are external links: http://example.org/dokuwiki/data/media/some_img.png. If you try to do this, you will get a permission denied message.

Dokuwiki by-passes these prohibitions by use of php scripts which do not use direct URL access. But the fckgLite filebrowser is outside of this system and needs work-arounds to handle images. Otherwise, you will be able to see the names of the images but not the images themselves, which will be replaced by the broken image icon.

Unix-type systems

Dokuwiki's media files are secured by an .htaccess file in the data directory which prohibits direct web access to the files stored in the data directory and all of its subdirectories. To by-pass this prohibition, fckgLite accesses the media directory indirectly through symbolic links in the fckeditor/userfiles directory. The defaullt .htaccess file in the userfiles directory allows complete we access to the media directory. If your wiki is open to the internet, you might want additional security. There is an .htaccess file in the fckg/fckeditor/userfiles directory which prohibits direct access to all files except image files. This file is named .htaccess.security. To use it you must remove the ”.security” extension and rename it .htaccess:

.htaccess.security
<IfModule mod_authz_host>
    Require all denied
</IfModule>
<IfModule !mod_authz_host>
    Order allow,deny
    Deny from all
</IfModule>
 
<FilesMatch "\.(gif|jpe?g|png)$">
<IfModule mod_authz_host>
    Require all granted
</IfModule>
<IfModule !mod_authz_host>
    Order allow,deny
    Allow from all
</IfModule>
</FilesMatch>
 
Options -Indexes

In order for this file to be effective, the Apache configuration file (httpd.conf) must apply the AllowOverride All directive either to the userfiles directory or to one of its parent directories. This directive must be in a Directory container, for instance:

<Directory "/var/www/html">

AllowOverride All

</Directory>

If you have to add the AllowOverride All directive, because it is not already in effect for the userfiles directory, then you will have to restart your web server. For more information about AllowOverride, see the Apache documentation.

Notice that the .htaccess security file only allows image files through the security wall. Urls for any other files will be denied. You can change this if you wish; for instance if you want to allow access to pdf files, you can add pdf to your list of allowed extensions:

<FilesMatch "\.(gif|jpe?g|png|pdf)$">

</FilesMatch>

Also see the page on installing the filebrowser.

Windows

if your filebrowser or image pop-up does not display images, then try placing one of the .htaccess friles from userfiles into your data/media directory. If the AllowOverride directive has been set to 'All' for the media directory or one of its parent directories, you should be able to see your images in the filebrowser. See the Unix discussion above for further details. It is also possible to use the unix style set-up for the filebrowser.

It is also possible to set the nix_style configuration option to true.

Also see moving_files.

Troubleshooting

If the above solutions do not work for you–if, for instance, you are on a hosting service that does not allow you to override its settings–then using the security version of .htaccess will block access to the image files and you will not be able to see them displayed in the image browser. The solution is this: in either the data/media directory (Windows) or the userfiles directory (unix), use the default .htaccess (the userfiles directory contains two copies of this file, the default .htaccess and a copy named .htaccess.open). These files contain the following directives:

order allow,deny
allow from all

Options -Indexes

If you use this version of .htaccess, you will have to secure your private files by creating secure directories as explained above in the section on moving files.

Installation Issues

For help with installing and configuring the filebrowser, see file_browser_install. Generally the filebrowser will install automatically, but if not the install page should help.

1)
Note: Even if you are on a Windows system, the forward slash is required to separate directory names.
media.txt · Last modified: 2019/03/11 08:28 by tower