Fonctionnalité Galeries de fichiers

Cette page est en voie de traduction Veuillez revenir plus tard...


La galerie de fichiers de Tiki est un gestionnaire de téléchargement. C'est également une collection de fichiers. On peut utiliser une galerie de fichiers pour distribuer du multimedia gratuit (mp3, podcasts), du logiciel (mises à jour, correctifs, documentations) et pour emmagasiner des fichiers que les utilisateurs peuvent télécharger à partir de pages Wiki, d'articles ou de blogues.

L’outil de la galerie de fichiers vous permet de créer et d’éditer des galeries. Vous pouvez utiliser le système Tiki de gestion des permissions pour spécifier qui peut créer des galeries, téléverser ou télécharger des fichiers. Des statistiques sont conservées pour chaque téléchargement. Vous pouvez ainsi produire des statistiques pour la plupart des fichiers téléchargés, la plupart des galeries de fichiers ainsi que pour les derniers fichiers téléversés.

Améliorations à partir de Tiki5

Depuis Tiki5, on peut accéder aux galeries de fichiers avec WebDAV.

Améliorations à partir de Tiki3

Depuis Tiki3, les galeries de fichiers supportent les collections d'images, incluant la navigation, et l'insertion dynamique de la syntaxe wiki nécessaire pour l'addition d'une image à une page wiki.

Comment créer une collection d'images avec la galerie de fichiers
La galerie de fichiers a été améliorée de telle sorte qu’elle peut traiter également des images, agissant ainsi de facto comme galerie d’images ou de fichiers podcast, avec des fonctionnalités additionnelles. This is to end up in newer tiki releases reducing code duplication between file galleries and image galleries, and users confusion on where to save and find files (whatever type they are). In the same way, in later Tiki releases, file galleries might also handle file attachments to wiki pages, ...

tiki3_browse_image_file_gal_00.png (87.07 Kb)


Le diaporama
Le diaporama de la galerie de fichiers a été amélioré.

Moreover, File galleries are closer to replace image galleries, since they include most (if not all) the previous functonality from image galleries, and benefit from the improvements in the file galleries.

Examples:

Image


New file types recognized by tiki
New file type icons have been added to file galleries in order to recognize and visualize them accordingly. They include: .7z, .flv, .mp4, .odg, odp, .ods, .odt, .ogm, .ogv, .svg.

tiki30_new_icons_file_gals.png (40.62 Kb)




- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

UTILISER les Galeries de fichiers

The file galleries section of Tiki is a download manager, you can create/edit file galleries which are collections of files, you can define with the permission system who can create file galleries, upload files and download files. Statistics are recorded for each download, rankings where defined for the top downloaded files, most visited file galleries and last uploaded files. Modules are also available to display last changed file galleries, last uploaded files, top downloaded files and top visited file galleries.

You can use file galleries to distribute free multimedia (mp3, avis, etc), to distribute software (versions, patches, releases), to add files that users can download from Wiki pages, articles or weblog posts, etc.

Image

If you enable the file galleries section from the admin menu you ll see a menu section in the main menu for file galleries. From the menu according to the permissions you have you will be able to list existing file galleries (where you can create a new gallery) or upload a file to a gallery.

A file gallery is just a collection of files that can be downloaded, files are kept in the Tiki database and the number of downloads for each file are registered.

The List galleries option in the main menu will take you to the following screen:

Listing File Galleries

File Gallery listing
Old~hs~File~hs~Gallery~hs~listing


From this screen you can create a new gallery, edit existing galleries, remove existing galleries, upload a file to a gallery or list the contents (files) of an existing gallery. The options you see as a user depend on the permissions the admins have set for your groups.

Creating file galleries


To create a new file gallery click the create new gallery link and the following form will be displayed.

Image

The same form is displayed to edit and existing gallery, you have to fill the gallery name, a description and the maximum number of rows (files) that will be displayed for each page in the file gallery listing.

You can make a gallery invisible to normal users unchecking the gallery is visible to non-admin users checkbox. This can be used to set-up galleries that can t be browsed but contain files that you will make available for downloading in your site using direct links to download the file.


If you want to allow uploads to this gallery from other users check the checkbox above the edit/create button. If the checkbox is not checked then only the gallery creator or admins can upload files to the gallery.

Uploading files


To upload a file you use the following form:

Image

In this form you enter a title and description for the file, the gallery where the file will be stored and then the file from your local disk to upload. If everything goes well you will see a message indicating that the file was uploaded.

Image

 Bug in Tiki 5.0
In Tiki 5.0, if you have specified that files are stored in the database rather than the file system, and if you can upload files but uploaded image files don't display correctly, try commenting out the last line of the file db/local.php. This bug will be corrected in the next release.

Link to the file using Wiki syntax (substitue in fileId=x: x = the fileId number):

[tiki-download_file.php?fileId=x|file name that you want to display]

Imbed an image

{img src="tiki-download_file.php?fileId=x&thumbnail=y" link="tiki-download_file.php?fileId=x" alt="alternate file name"}

Link to the file using html syntax

<a href="tiki-download_file.php?fileId=x">file name </a>

Batch uploads

(click to expand) Batch Upload Bug in 4.0 and 4.1

There are essentially three ways to upload mutliple files using the file gallery (not image gallery) feature...

  1. Use the standard upload interface's "Add" button and add multiple files one at a time
  2. Upload a flattened (no nested directories) zip file and check the "Unzip zip files" checkbox
  3. Enable "Directory Batch Uploading" using Tiki's Admin Panel (tiki-admin.php) for the "File Galleries" feature.


As of 4.0 and 4.1...

The "upload multiple files one-at-a-time" (#1 above) feature still works on CentOS, but not on Windows XP.

The "upload and unzip zip file" feature (#2 above) is broken for Tikis installed on CentOS (likely all Linux versions) and on Windows XP.

The bug seems to be connected to a new file quota feature. A more detailed description can be found here: Batch-Upload Bug Reported Here

This bug exists whether or not the user chooses to store the files in the MySQL database or in a system file directory.


If you have the right permission to batch file uploads then you will be able to make a batch upload of files by uploading a .zip file to the gallery and checking the batch-upload checkbox (if you don't check it the zip is uploaded as a single file).

Note that you must only give batch uploading permissions to admin since if users can make batch uploads the results can be unpredictable.
Note that you can use the Batch uploads only when you don't use the database to store the content of the files!

Tiki does not unzip files in the subdirectories of the zip.

Once you have some files uploaded to the gallery you can visit the gallery from the gallery listing menu and see the uploaded files:

Listing file galleries and downloading files


Image

From this screen you will see the gallery description and the files uploaded to this gallery (the number of files per page varies), you can order the list by any of the columns in the listing. Clicking the get link in the actions column will download the file to your local disk.

Permissions


The following permissions can be set for the file galleries section:

Image

The tiki_p_admin_file_galleries is a master permission that automatically includes the other permissions.

You could add a discussion of how to create a link in a Wiki page that links to a file in a File Gallery. While this information might probably belong here, to cover linking to this item from anywhere, it be referred to in or copied into Wiki-Syntax Links .


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ADMINISTRER les Galeries de fichiers

Admin Access

To access administration, go to Home Page and, on the Menu, click on "Admin (click!)".

Activate the feature


To use file galleries, first you must activate the feature. Admin>Home>Features.

File galleries

Image File galleries


From the Tiki Admin Panel, click the File galleries icon to display its settings panel, the top of which appears like so:

Clicking the File Galleries icon on the Admin Panel (see TikiAdminSettings ) takes you to the File Galleries settings.

Image


This panel is almost identical to the image galleries panel. Select the home file gallery, the comment settings for file galleries and if rankings/comments are used or not for file galleries.

There's an important setting for the file galleries: the storage strategy for files. You can choose one of two options to store file gallery files:

  • Store files on the database
  • Store files on a directory


The differences and settings needed for each option are explained below:

Storing files on the database


If you decide to store files on the database then each file data will be stored on a database column (field) this has the following advantages and disadvantages:

  • You don't need to configure anything else.
  • You may have problems if you plan to store large files
  • The database can grow a lot making more difficult to make backups/dumps

Storing files on a directory


If you decide to store files on a directory you must indicate the path to a directory where you will store files. The directory can be absolute or relative to the Tiki directory for example:
files/
/www/tiki/files/
/home/tiki/files/
files/uploads/
can be configured as directories.
Before 1.8.1, ending "/" was mandatory.

Storing files on a directory has the following advantages and disadvantages

  • You must configure properly a directory to store files
  • You can upload files of any size (if you have space)


You must ensure that:

  • The configured directory exists and PHP (Apache) can read/write it
  • For security, only Tiki can read or access the contents of that directory. Do that with one of the two following options.
    [+]


You may need to ask your ISP/hosting service for an upload strategy and instructions if the ISP/hosting allows uploads (some PHP's have file uploads disabled for unknown reasons, maybe to prevent disk space consuming). Since Tiki can be configured to store fles on the database or a directory if there's a way to handle uploads then Tiki can use it :-) choose the strategy that is best for you.

Move files between them

Since Tiki5 (and backported to Tiki4.2) you can move the file in the database to the file system and the other way round, which is very helpful when migrating a tiki from one hosting to another one, for instance.

Quota

tw >=4
It is possible to limit the volume that is uploaded to all the file galleries or a specific file gallery. A quota to a file gallery applies to this file gallery and all the file galleries under it.
As soon as the limit is reached not other files can be uploaded. The user will see an error message that the quota is reached. A mail can be sent via the Mail notifications feature.

tw >=5
The objects where a file is used (through the plugin IMG, FILE, link containing tiki-download_file.php , dl, preview, thumbnail, thumb, display) are collected. Be careful, the list can not be complete (For instance, reference to a file in the layout is not collected).
When you want to delete a file, a warning is posted if the file is still in used.
If you check in 'edit->file gallery' 'Perms of the backlinks are checked to view a file', the permission checking will be changed. If you see on object that uses a file located in a gallery you can not see, you will be able to see the file. You will be able to download a file that is used in at least one object you can see.

Filtering file uploads


You can set up filters for filenames so filenames will be checked and maybe rejected depending on their filenames. Filters are regular expressions perl-like without the // delimiters.

Filename must match


A regular expression that must be matched to accept the file example [A-Za-z]* (filename can only have a-z letters)

For example, if you want to require that uploads must have a wordprocessing file extension, you could enter .*\.(odt|sxw|doc|dot|rtf|wpt|frm|wpd|txt|ODT|SXW|DOC|DOT|RTF|WPT|FRM|WPD|TXT)

Filename must not match


A regular expression that if matched rejects the file, example \.gif (rejects gif images note that the period must be escaped since we are using regular expressions) If you don't know anything about regular expressions just leave the fields blank and all the files will be accepted.

File galleries search indexing

If you want the files content of your files galleries to be accessible by a search, and if you have a script that extracts the file content into a text, you can associate the script to the Mime type and the files content will be indexed.

If you want to search on files in the file galleries, you must provide handlers to extract the text for the file's MIME type. The commands, such as strings or pdftotext must exist on your server. The type-command associations are defined in the Admin->File Galleries page.

MIME Type System command Ubuntu/Debian package with command
application/ms-excel xls2csv %1 catdoc
application/ms-powerpoint catppt %1 catdoc
application/msword catdoc %1 or strings %1 catdoc
application/pdf pstotext %1 or pdftotext %1 - pstotext
application/postscript pstotext %1 pstotext
application/ps pstotext %1 pstotext
application/rtf catdoc %1 catdoc
application/sgml col -b %1 or strings %1 bsdmainutils
application/vnd.ms-excel xls2csv %1 catdoc
application/vnd.ms-powerpoint catppt %1 catdoc
application/x-msexcel xls2csv %1 catdoc
application/x-pdf pstotext %1 pstotext
application/x-troff-man man -l %1 man-db
text/enriched col -b %1 or strings %1 bsdmainutils
text/html elinks -dump -no-home %1 elinks
text/plain col -b %1 or strings %1 bsdmainutils
text/richtext col -b %1 or strings %1 bsdmainutils
text/sgml col -b %1 or strings %1 bsdmainutils
text/tab-separated-values col -b %1 or strings %1 bsdmainutils



Several tools can be used to extract search strings; many Unix sites have "strings", which can detect things which appear to be text within files although without the accuracy of more specialized tools.

Ensure that the system command entered prints its output to the screen (standard output) and not to a file. Try the command on a console and check the manual. E.g. you have to add a trailing "-" to pdftotext.

Automatic deletion of old files

tw >=5.0
If you check this feature, the user will be able to say after how much time his file can be deleted automatically after the last file update
When the file will be deleted a mail to emails will be automatically sent with the deleted file attached. The emails are comma sperated email.
in order to have this feature working you must step up a cron job.
Create a file like that in tiki root
{CODE()
<?php
include_once('tiki-setup.php');
if ($prefs'fgal_delete_after' == 'y') {
global $filegallib; include_once ('lib/filegals/filegallib.php');
$filegallib->deleteOldFiles();
}
{CODE}

Admin view

Administrateur can use an admin view of the file galleries.
This view has its own column display settings. All in the file gallery and its sub-filegalleries are displayes. The explorer is automatically hidden. In thiv view additional filtering are possible:

  • Not modified since
  • Not downloaded since
  • Orphans will shows only files taht are not referenced. Careful: this feature is not perfect, some links can miss

Setting the maximum upload size.

If your Tiki is hosted by an ISP, you'll need to find out how set the maximum upload size. If you have command line access, you'll need to adjust some parameters setting in your server's php.ini file. The example below shows an maximum upload size of 10 megabytes.
Copy to clipboard
upload_max_filesize = 10M file_uploads = On post_max_size = 11M memory_limit, max_input_time, max_execution_time must be appropriate
  • file_uploads: Must be On
  • upload_max_filesize: is the maximum of the sum of the sizes of all the files that you are uploading.
  • post_max_size: ideally this value should be larger than the value that you set for upload_max_filesize. post_max_size is the upload_max_filesize plus the sum of the lengths of all the other fields in the form plus any mime headers that the encoder might include
  • memory_limit: Only to be properly assign if --enable-memory-limit is on
  • max_input_time:
  • max_execution_time

If you can not change your php.ini, you can modify your .htaccess by adding these lines

Copy to clipboard
php_value upload_max_filesize "10M" php_value post_max_size "11M" php_value max_execution_time 300 php_value max_input_time 300 #if the files are stored in the database, you can add the following line php_value memory_limit "64M"


If you change your php.ini, You will need to re-start your apache or other webserver for the change to take effect.
More info

If you are storing your files in the database, you need to check this MySQL variable:

max_allowed_packet


This variable can be located in the "my.ini" file as shown in the figure below.
The "my.ini" file is located in the same directory as your MySQL server install.
For example, on a development box, you may have installed it at:

"C:/Program Files/MySQL/MySQL Server 5.1/my.ini"

If you can't find a my.ini file, look for "/etc/my.cnf" instead.

Image

Open the "my.ini" file and find the [[mysqld]] section.

If there is not already an entry for your "max_allowed_packet" variable, then add one as shown
in the figure above (e.g. max_allowed_packet=64M).

Make sure that you have enough storage allocated to your database to handle the size of your files!

Once you have added an entry to set this variable as in the figure above, save
the modified "my.ini" file and restart your MySQL server.

Again, on a typical Windows development box, you can locate your "mysql" service
(if you have it running as a service under Windows: Start->Run->"services.msc")
and simply right-click and choose "restart".

Image

You can use the phpMyAdmin console to check the value of your "max_allowed_packet" variable.

Select the "Variables" tab on the main phpMyAdmin screen. Scroll down until you find the
correct variable, and then check that the value matches that which was set in the "my.ini" file.
See the figures below...

Image

Image

Podcast

This type of files allows to have file directly accessible from an url
ex: http://mysite.com/podcast/1233243234234.mp3
In a regular file gallery, the files can be accessed with
ex: http://mysite.com/tiki-download_file.php?fileId=1
By preserving the extension, the file can be directly used in the rsspodcast and for podcast players

Trouble shooting

  • When you download a file, you get an invalid file. In linux you can check if the file is correct and do not contain error messages with hexdump -C your_file




- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Galeries de fichiers pour les images

Since Tiki3, file galleries have more features to support image galleries also from your local images. For images already elsewhere in internet, use the simple {img src=http://domain/foo.jpg} as usual.

Enable the setting
First an admin has chosen file galleries to manage images also. This option can be enabled at "Admin home > Editing and Plugins > General settings" (tiki-admin.php?page=textarea): "Use File Galleries to store pictures".

Let's see an example of this new usage of the file galleries.

Upload an image

Through editing a wiki page

In Tiki3, you could do that through the following option of the wiki edit interface:

Image

Starting in Tiki4, and being improved in Tiki5, the edit interface has been revamped and you can open the form to upload images through the appropriate icons in the toolbar area on top of the editing area of the wiki page: Image Image

Image

The first one, Image , opens the plugin helper to add references to images available on Internet somewhere (inside or outside tiki).

Image

The second one, Image , opens the interface to upload images. By default, that interface shows in the basic mode to allow uploading a single image:

Image

However, if we click on the appropriate button on top of the previous type of window, we will see the advanced interface to upload several files with images at once or even a single compressed zip file with many images to be processed in batch mode, as well as selecting the user or categories to link those images to.

Image

Directly through file galleries

Image

Select the image/s to upload from disk


Chose file (step 1 in the image below), file gallery to set the image to (step 2), optional parameters (step 3, quite self explained), and click on upload (step 4).

Image

Once the image is successfully uploaded, you will see a screen like the following:

Image

There you can click on the button "Additional info", and it will display the links and syntax you need to copy in order to re-use that image in youru wiki page, forum, tracker, etc., or in external web sites.

Image

Proceed as usual then onwards. Keep in mind that if you add png images with transparencies, then many url's shown by tiki from file galleries have the &preview or &thumbnail" attached to them, and thus, they will be converted to .jpg (without transparency) by GD on the fly for that modified smaller display. Just remove that param if you wish and the png will be shows as png.

You can also add the extra param "class=reflect" for nice visual effects if you have JQuery and its corresponding JQuery plugin enabled in your site.

Use existing images

Moreover, in order to use existing images from file galleries you can just use the url of the file, for instance, and use the IMG tag as usual:

Image

You will also have the option to display the image in preview mode when passing your mouse pointer over each image.
Image

Or you can use the new image browser within the file galleries, which will allow you to, while editing a wiki page, click on an image from the image browser from the file gallery window and insert the needed code to display where you had your cursor.

Image



Liens utiles
  1. Le contenu de cette page a été inspiré de la documentation anglophone suivante
  2. Le site 'Tiki for Smarties' offre de très bons conseils à propos de la gestion de fichiers sur Tiki (en anglais)
  3. Cette fonctionnalité 'Galeries de fichiers' remplace la fonctionnalité 'Galeries d'images'
  4. Une autre façon de gérer des fichiers en ligne
  5. Liste des Plugins liés, permettant d'interagir avec des fichiers, à l'intérieur d'une page Wiki
  6. Liste des modules liés, permettant d'insérer une liste de fichiers dans la colonne de droite ou de gauche
  7. Liens externes pour en savoir plus à propos de la gestion de documents
  8. Pour choisir un bon système de gestion de fichiers, il est bien de pouvoir comparer ceux qui existent sur le marché :