Preview File Galleries MOD By RussWilde
NOTE: I would've put this in a more suitable place, but I was having ISP problems
MORE IMPORTANT NOTE: I attached some slightly duffed up files here, I have replaced them with a fixed up version, which corresponds to the documented db changes.
The purpose of this MOD was to create file galleries listings which could (optionally) have a preview thumbnail image of the file you are downloading. Benefits are fairly obvious, it enables the user to feel confident that they are downloading what they are actually looking for, because they can see it before they are comitted to downloading.
What does this mod do?
What this mod does is add an extra column in the tiki-list_file_gallery view which can contain a thumbnail representing any or all files in the gallery view.
This extra column can be enabled and disabled through the edit gallery page and not every file needs to have a thumbnail.
The mod (Once installed) is implemented in the following way;
- Enable thumbnails for the file gallery you desire through the edit gallery interface - the option is in the same place as you choose to display file sizes, names, descriptions etc.
- upload the image intended to be used as the thumbnail to a tiki image gallery, NOTE you can supply full sized screen grabs as images, the image galleries thumbnail sizes are used for the file-gallery listing thumbnails.
- Make a note of the id number of the images you wish to use - you do not need to know anything else. Upload or edit the files you wish to display the thumbnail for, in the edit / upload dialog, you can specify a thumbnail index, this is the image number of the image you wish to use.
- List the gallery and make sure all is in order.
You should see something like this...
Some Questions Answered
Do I have to provide a thumbnail for every fileuploaded?
Not at all, if you set the thumbnail index to zero (0) no thumbnail is displaid for the file in question. Other files in the same galleries still display the thumbnails assigned though.
Can I change the thumbnail index / turn off thumbnails after file creation?
Of course you can! The interface used to edit files in the file gallery (clicking the little edit icon in the listing - when you have permission) will allow you to specify a new thumbnail index or specify a zero if you want to stop displaying the thumbnail for tha file.
You can also edit the file gallery, if you want to turn off the thumbnails for the whole lot, you can simply untick the thumbs box in the revised edit file gallery screen, again depending on permissions. Disabling thumbnails for the gallery (NOTE the gallery remebers the thumbnail indexes even if they aren't displaid).
How do I get hold of this MOD??
I'm glad you asked...
The current version "The nasty hack version" is attached to this page, I'll update it when I've made some improvements.
Installing the mod
okay, this is a bit of a fiddle really, but it works well.
We have to add a field to the tiki_file_galleries tables called show_thumbnails of the type VARCHAR( 1 ) with a default value of 'n'.
I did this through PHPMyAdmin, but in SQL the query is somethig like
ALTER TABLE `tiki_file_galleries` ADD `show_thumbnails` VARCHAR(1) DEFAULT 'n' NOT NULL
Next we have to add an integer value to the tiki_files table called thumbnail_index, In SQL;
ALTER TABLE `tiki_files` ADD `thumbnail_index` INT(8) DEFAULT '0' NOT NULL
Once that's all set up, just upload the files to their proper directories.
If you recurse directories when you unzip the files, you can just dump everything in the tiki root folder and it'll be fine.
As always, make a backup of valuable files!!