|
|
How-to's für TWGDie Nummerierung der Howto's entspricht der Reihenfolge der Entstehung. Ich kann sie jedoch nicht einfach ändern, da es Links von älteren TWG Installationen gibt, welche darauf verweisen. Ich habe dafür jeden Abschnitt der Wichtigkeit der Howto's nach sortiert.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dateiname | Ausdruck | Speicherort | Beschreibung |
|---|---|---|---|
| header.htm | twg_headerhtml | TWG Ordner | Wird im Kopfbereich eingefügt |
| top.htm | twg_tophtml | TWG Ordner | Wird direkt über der TWG eingefügt (vor TWG 1.7.8 top.htm war header.htm - Seht unten in der Übersicht was der Unterschied ist!). |
| bootom.htm | twg_bottomhtml | TWG Ordner | Wird direkt unter der TWG eingefügt (vor TWG 1.7.8 bootom.htm war footer.htm - Seht unten in der Übersicht was der Unterschied ist!). |
| footer.htm | twg_footerhtml | TWG Ordner | Wird im Fussbereich eingefügt |
| left.htm | twg_left | TWG Ordner | Wird im linken Bereich eingefügt. $left_htm_width definiert die Spaltenbreite |
| right.htm | twg_right | TWG Ordner | Wird im rechten Bereich eingefügt. |
| overview.htm | twg_overviewhtml | TWG Ordner | Wird unter den Alben auf der Hauptseite eingefügt |
| thumb.htm | twg_thumbhtml | TWG Ordner | Wird im Bereich unter den Vorschaubildern auf der Vorschauseite eingefügt. $thumbnail_offset_y definiert die Höhe des Inhalts, der eingefügt werden soll. Damit arbeitet die automatische Erkennung der Vorschau perfekt - ;). |
| image.htm | twg_imagehtml | TWG Ordner | Wird auf der Bilderseite unter dem Detailbild eingefügt |
| topx.htm | twg_overviewhtml | TWG Ordner | Wird auf der TopX Seite unter der Vorschau eingefügt |
| thumb.htm | twg_thumbhtml | subfolders | Thumb.htm kann im Hauptordner und jedem anderen Ordner eingefügt werden. Damit kann zum Beispiel ein Link auf einen Ordner oder ein Download generiert werden. |
Übersicht:
header.htm |
||||
left.htm |
top.htm |
right.htm |
||
overview.htm, thumb.htm, image.htm, topx.htm |
||||
bottom.htm |
||||
footer.htm |
||||
TWG folder is where the index.php and config.php is located. All files are included in a <tr><td> </td></tr> therefore this are no compete pages! Only put the stuff in there you want to display!
ALL files can be language dependent: E.g. overview_de.htm, thumb_de.htm, topx_de.htm, image_de.htm
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
4. How to setup a random image of topx image on a different site/frame You can setup a random or topx image on an other web site which links to your gallery. The following two lines show the image and the link tag:
The image:
<img src="image.php?twg_album=xxx&twg_random=1&twg_type=random&twg_random_size=200">
The link with image:
<a href ='index.php?twg_random=1'>
<img src="image.php?twg_album=xxx|zzz&twg_random=1&twg_type=random&twg_random_size=200">
</a>
You have to add the path to the image.php and index.php to the example e.g. http://www.mygallery.com/tinywebgallery/index.php
NEW 1.6: TWG can now go recursively through your directories! Simply add &twg_random_subdir=true to the img part e.g.:
<img src="image.php?twg_album=&twg_random=1&twg_type=random&twg_random_size=200&twg_random_subdir=true">
Then you don't even have to specify an album. Without album the random images starts from the root! Please note: Only unprotected galleries are included in the search.
NEW 1.7: You can show the most viewed images as well now! set twg_type=top in the url above. If you use twg_random=1 then the most viewed image of the folder is shown. twg_random=2 shows the 2nd most viewed image and so on ;). You should use &twg_random_subdir=true to get the most viewed image of a sub tree and not only of this folder. Please only specify one folder at twg_album. If you leave twg_album empty then the most viewed image of the whole site is shown!
If you would like to show the most viewed images of e.g. 2 different folders on one external site please set twg_random to the value of twg_album. Then always the most viewed image of each folder is picked.
Example random image |
Example TopX - most views |
5. Wie man ein Bild für ein Album definiert Wenn Du keine Bilder im Album (oder nur in anderen Alben) hast oder nicht möchtest, dass ein Bild aus dem Album angezeigt wird, kannst ein Bild für jedes Album anlegen. Man brauchst nur ein beliebiges PNG Bild, das man 'folder.png' nennst in den Album-Ordner zu legen. Ein JPG Bild benennst man einfach von .jpg nach .png um.
Wichtig: Es wird hierbei die Originalgröße der Bilder verwendet! Das macht es zum Beispiel möglich grosse Bilder auf der Haupt-Albumseite und kleinere auf den Unter-Albumseiten darzustellen. Wenn die Alben geschützt sind muss man 'private.pnp' statt 'folder.png' verwenden.
6. How to set a gallery name different from the folder name (e.g. for enhanced sorting) You can change the name that is displayed for a directory. By default the directory name is used. But sometimes it makes sense to change this:
Create a file named foldername.txt in the folder you want a different folder name. Then put the text or html for an image into this file. The text can be any valid HTML and is inserted in a <span></span>. See the demo 1 where I have set an image for a folder!
The name can be language dependant as well! By adding the language to the filename you can provide extra translations. e.g. for German: foldername.txt -> foldername_de.txt.
Please note: Please use the html representation in the files for special characters: ä -> ä
Since 1.6 you can simply use a sorting prefix for the directory name on your hard disk as well. If you use a prefix in the following format then this is automatically removed: 001___ 002___ .... Important is that the prefix has 6 characters and the chars 4,5,6 are underscores. You don't need a foldername.txt if this is enough for you.
Since 1.7.4 you can use a file called config_sort.php. This makes it possible to sort a sub directory different then the rest. You only can place the following parameters to this file: $sort_images_ascending, $sort_by_date, $sort_by_filedate, $sort_albums, $sort_albums_ascending, $sort_album_by_date. This file works for image sorting as well. Don't use a custom folder config.php for sorting because settings in there would overwrite settings global during caching. If you use private galleries you have create a config_sort.php in the pictures folder as well. There you store the sorting of the main folder!
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
7. How to add a folder description (shown below the gallery name) or an image "header" To create an additional text below the bold folder name you have to create a file named folder.txt in the folder the text should appear. Then put the text into this file. The text can be any valid HTML and is inserted in a <span></span>. The style class is twg_folderdescription and can be found in the style.css. The folder description can be shown on the image page as well. By turning the switch $enable_dir_description_on_image to true this description is shown there as well! For different text on the image page image.txt can be used - see howto 28.
The description can be language dependent! By adding the language to the filename you can provide extra translations. e.g. for German: folder.txt -> folder_de.txt.
If you use language dependant versions this is only shown if the language can be detected. If the language version does not exists the normal description is used - if this is not present nothing is displayed!
Please note: Please use the html representation in the description files for special characters: ä -> ä
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
8. How to create a language filePlease send me the language files if you want to support TWG. Please make sure to use the latest version of TWG and "Welcome to the TinyWebGallery" as title. Please make sure to translate the latest version of a language file.
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
Use $charset = "UTF-8"; for the language file!
Please note:
Please use the html representation in the language files for special characters: ä -> ä I use a nice macro "HTML Encoder" for Textpad. Just google for it if you want to save yourself some time ;). Since TWG 1.6 this is not really needed anymore because UTF-8 is used almost everywhere.
9. How to change colors of TWG All main style settings are located in the style.css. This file is well documented. Every area has its own part in the style sheet. If you change or insert a color and nothing is changing be sure that you define the settings for a link as well! To search for a certain style install the web developer toolbar extension for Firefox!
The color manager in the TWG Admin should help you to configure the colors of TWG. You can
You can select transparent as color for the background of your areas. I have provided a couple of example background images that become visible if you click on transparent and then on one of the background areas of the preview. You have to provide your own background images! Read how-to 22 and 25 for some help.
After creating the style sheet you have to copy the content and save if like described before!
If you create the style sheet with the color manager you get some additional styles for the hovering effect if you use a background color - Please read how-to 27 for details about this!
I recommend not to make any changes in the style.css. Save this settings in the my_style.css.
This makes it easier for you to keep track of your changes and if you update TWG. All changes in my_style do override the settings in style.css. Remove this file if you don't use it because otherwise its transferred to the server! The settings of my_style.css are valid for all galleries.
To change the background and the color of the iframes (login, comments ...) go to i_frame/iframe.css.
Please note - you can only have one style of the iframes. If you use different styles for different folders please select colors that fit to all of them!
Please read how-to 22 if you only want to change the background of a gallery. The borders of the gallery are in the framestyle.css!
Summary - This is the order the styles are loaded:
If a album folder is read protected from the web you have to use a different way: It is also possible to place the style sheet in the cache folder (and sometimes mandatory if you have directory names with characters that have to be encoded). Create a style sheet named <url encoded folder name>_style.css. If you are using recursive folders the folders have to be separated with an _. The easiest way to name the file is to go into the cache folder and look for the folder name at an image (It is url encoded!: e.g. Usa (+ü$§!%&-;) -> Usa+%28%2B%FC%24%A7%21%25%26-%3B%29) . Copy the folder name part and add the _style.css to the style sheet name.
10. Wie man die PHP Version seines Servers feststellt und, ob dieser TWG unterstütztEs gibt eine Datei 'info.php' im Hauptordner von TWG. Wenn Du diese Datei statt der 'index.php' im Browser aufrufst, prüft TWG die Anforderungen und gibt sie aus. Das hilft Dir, falls TWG bei Dir nicht richtig läuft oder nicht alle Eigenschaften zur Verfügung stehen. Bei den TWG HowTo /FAQ findest Du Erläuterungen und einige bereits gelöste Probleme dazu. In der TWG Administration (unter 'Info') sind weitere Hilfen, wie zum Beispiel die notwendigen Datei und Ordner Attribute zu finden.
11. Wie verlinkt man direkt in eine mit Kennwort geschützte GalerieEs ist möglich in eine Galerie oder ein einzelnes Bild zu verlinken. Kopiere einfach den Link in der URL! Die funktioniert aber nicht mit Kennwort geschützten Galerien! Um direkt in einen geschützten Ordner zu verlinken, kopiere die URL von der Galerie zu der Du verlinken willst. Du musst Dich anmelden um diese URL zu erhalten! Danach musst Du folgenden Parameter an die URL anhägen: &twg_private_login=<Galerie Kennwort> . Bitte beachte: das Kennwort ist nicht verschlüsselt. Dieses Feature wird zu einer der nächsten Administration hinzugefügt (hoffe ich ;)). Wenn Du verschlüsselte Kennwörter nutzt (siehe How-To 1.7) musst Du das verschlüsselte Kennwort anhängen!!
Der Parameter $enable_external_privategal_login muss auf true gesetzt werden um diese Art des Logins zu aktivieren. Standard ist false!
12. Wie schützt man eine Galerie (und wie setzt man mehrere Passwörter für eine Galerie und warum ;))Um eine Galerie mit einem Passwort zu schützen musst Du eine leere Datei mit dem Namen 'private.txt' (oder was auch immer Du als Passwort Datei in der Konfiguration definiert hast) in dem zu schützenden Verzeichnis erstellen. Wenn die Datei leer ist wird das Passwort aus der Konfiguration ($privatepassword) verwendet. Wenn Du eine Galerie mit einem anderen Passwort schützen möchtest, musst Du das Passwort in die 'private.txt' datei eintragen.
Bitte lest howto 1 um eure Daten vor direktem Zugriff zu schützen!
Dies ist die Beschreibung aus der config.php. Ich möchte ein paar mehr Kommentare zu diesem Punkt geben, da mehrere Leute danach fragten:
Du kannst verschiedene Passwörter für jedes Verzeicnis verwenden. Erstelle einfach eine Passwort Datei und trenne die unterschiedlichen Passwörter mit einem ','. z.B. test,test2,test3. Stelle sicher dass keine Leerzeichen zwischen den Kommas und Passwörtern sind. Wenn $encrypt_passwords=true ist musst Du das generierte Passwort nutzen!
Durch die Verwendung von mehreren Passwörtern kannst Du Freunden Zugriff auf einige Verzeichnisse geben und z.B. Deiner Familie Zugriff auf andere Verzeichnisse. Der Vorteil ist nun das zwei Gruppen auf dieselben Verzeichnisse zugreifen können! Oder Du kannst alle Galerien mit einer Art "Super Passwort" schützen und ein paar Verzeichnisse mit einem 2ten Passwort um nur Zugriff auf diesen Bereich zu gewähren.
Bitte beachten: Wenn ihr Galerien mit einem Passwort schützt verwendet bitte nicht das Popup auf der Detailseite, da der dort verwendete Link nicht geschützt ist und kopiert werden könnte. Verwendet bitte den Fullscreen Modus oder die Lightbox wenn eure Bilder 100% sicher sein müssen.
Ordner Bild für geschützte Galerien
Du kannst auch Dein individuelles Bild für eine mit einen Passwort geschützte Galerie verwenden. Erstelle eine Datei mit dem Namen private.png und platziere es in dem geschützten Ordner. Die Größe sollte der in der config.php eingetragenen entsprechen (Standard ist 120 x 120). Seit 1.6 wird ein Bild automatisch erzeugt wenn $autogenerate_private_png = true; (=Standard) gesetzt ist. Die private.png Dateien werden immer von den automatisch erzeugten überschrieben!
Wichtig: Wenn Du eine andere als in der config.php angegebene Größe verwendest wird die Original Größe benutzt - Dies begründet sich darin, daß Du individuelle Ordner Bilder nutzen kannst, welche das gleiche Verhalten haben.
Neu 1.7: Du kannst eine private.txt im Hauptordner verwenden! Dann erscheint ein globales Login Fenster.
Neu 1.7.5: private.txt wirkt nun rekursiv und schützt alle Unterordner mit.
Neu 1.7.6: Nutzer basierte Galerien
Seit 1.7.6 ist es möglich zu einem anderen Schutzmodus zu wechseln. Um eine geschützte Galerie zu betreten nutzt Du dann Dein TWG Login/Passwort. In der private.txt trägst Du die Login(s) ein, welche Zugriff auf dieses Album haben sollen.
Die folgenden zwei Parameter sind verfügbar:
Warum gibt es nun 2 Arten? Es ist abhängig davon, was Du benötigst und bevorzugst.
Dies sind die Vor- und Nachteile der Nutzer basiert geschützten Galerien:
+ Deine Nutzer haben alle nur jeweils ein Login um auf all Ihre Galerien zuzugreifen
+ Geschützte Galerien sind komplett versteckt, das die Anmeldung durch das normale Login erfolgt
+ Du musst keine Passwörter mit e-mails zu Deinen Nutzern verschickena (Irgendwie musst Du sie dennoch informieren)
+ Du kannst einen einzelnen Nutzer deaktivieren indem dessen Login entfernt wird. Das entfernen des Passwortes in dem anderen Modus würde alle anderen Nutzer ebendfalls betreffen.
- Du musst alle Nutzer welche Zugriff bekommen sollen in die private.txt eintragen. Im Passwort Modus hast Du nur ein Kennwort in dieser Datei.
- Meiner Meinung nach haben die Nutzer basiert geschützten Galerien ein größeren Administrationsaufwand.
- Du benötigst einen Account für jeden Nutzer.
Nun wähle den Modus welchen Du bevorzugst ...
13. How to configure watermarks and text on an imageThe description at the watermark section is a little bit short in the config.php file. Therefore I will give some additional explanations:
You can use individual watermarks for each folder! You can do this by creating the following files:
PLEASE NOTE: There is a flag called $resize_only_if_too_big - If you have images smaller than the small_pic_size and this flag to true no small images are created and the originals are used instead! As a consequence no watermarks are printed on these images. You have either to add the watermark by yourself or set this flag to false. But then you images are enlarged to the small picture size.
IMPORTANT: If you make any changes to the watermarks you have to delete the images from the cache directory because the watermarks are already added to the thumbs and small images!
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
14. How to track errors if TWG does not work on your system.
15. How to change or extend the smiliesTWG shows smilies in comments and captions if the flag $enable_smily_support is set in config.php (=default).
I have only provided a couple of smilies. But you can add your own set or extend the existing set by yourself. Maybe you want to change their size if you changed some fonts ...
The smilies are in the directory <installdir>/buttons/smilies.
All smilies which are copied in this directory are available in TWG. TWG reads the whole directory and matches the filenames with the characters you normally would enter for a smilie - e.g. ;) -> ;).gif. There are some characters that are not allowed on he file system which are heavily used. I have mapped the following:
: -> a
\ -> b
/ -> c
* -> d
e.g. :) is the file a).gif !
If you have a nice set of smilies and want to share them with others please sent them to me. Thanks.
16. Linking to a web site instead of downloading a fileIf you have some pictures e.g. from a remote site and want to link to this site if someone wants to download the image you can create a file named link.txt in this directory (Check the Beauties folder of the demo!). The file has to contain the starting <a> tag with the id='adefaultslide' . e.g.
<a href="<your url>" id='adefaultslide'>
The link is valid for all images of this directory! - please don't forget the id - javascript will fail if this is missing!
17. How to use a directory based config.php
18. How to enable e-mail notificationBy default e-mail notification is turned off and sending of emails is disabled. In the config file are two main parameters you have to change: $show_email_notification and $enable_email_sending!
To configure your e-mail set the $show_email_notification and $enable_email_sending to true. If you go to the overview page you can now register and un register on the right upper menu.
E-mail can be sent from the TWG Admin!
Now set the config.php to the following settings:
$encrypt_emails = false ; // for testing!
$youremail="<your e-mail>"; - This is the from e-mail address of the registration!
$default_subject, $default_text and $email_bottomtext are the defaults for the "send emails" screen. You can change them how you like.
Register yourself on the web site and check if you get the registration e-mail - Then login and send a notification message!
go to the counter/subscriber.xml - your e-mail address should be in there. Delete this file and set the following switches in the config.php:
$encrypt_emails=true;
$encrypt_emails_key="A random string- the longer the better - NO special characters here";
Make sure that the counter folder and the subscriber.xml cannot be read from the web (chmod 700 or 770 if possible). You find more information about the parameters on the installation page or in the config.php. If your php does require that 777 is used please use a .htaccess file to protect your folder. The minimum protection is to enable encryption for the stored emails!
You can be notified if someone enters a comment or vote for an image. Enter the e-mail where the notification should be sent to and enable the comment or rating notification. One mail is send for each entered comment or vote!
19. How to enable download of a whole directoryYou can provide a .zip file that the user can download instead of viewing/downloading a single image. Create a .zip file with the images you want your users to download. Store it in the directory where the images are located. The file name are the directory names with .zip as extension. e.g. Mexico -> Mexico.zip. Please use folder names without special characters. Some web servers don't allow direct links to this kind of files.
Important: If you are in a subdirectory like pictures/Mexico/Palenque the name of the zip/txt file is not the last directory only. They have to be connected with an _. In the example here this would be Mexico_Palenque.zip!
You have to activate the download in the config.php (default is enabled). If no archive can be found the normal settings for viewing/downloading of an image is used.
If you don't have that much space on your web space (like on funpic where the file limit is only 1 MB) you can create a file <foldername>.txt and put the url to your zip file in there. In the example this would be Mexico.zip. You don't need the Mexico.zip anymore!
20. How to link to pictures in a remote http directoryThis a really nice feature. You can link to images which are located on a remote web server. You have to have two things:
The directory structure of the images has to be on the local web server. Inside the directory have to specify a file called url.txt where the url of the remote images are stored. Make sure that the url starts with http:// and ends with an /. Inside the local directory you can use all the other settings like described in how-to 17. Even private works but is not really save because the images on the remote directory have to be available (but if no one knows :) ...). This does not work recursive! If you have different directory levels on the remote server you have to create a url.txt for each directory. If you have a space in the path to the images please replace this with an %20. The best way is to navigate with the browser to the directory and copy the url. If you have black images then please check your image names - special characters do not work on all web server (on most they do not!).
e.g. http://<your domain>/<your directories>/
A running example can be found here:
http://mdempfle.md.funpic.de/pictures/2006_06_boas/
simply put it in an url.txt - You can try the url first in the browser. You should get a nice listing there.
The thumbnails and the small web images are still stored in the cache to provide a performance which is only slow at the first access and in full screen mode! Special characters are not supported to be displayed properly as captions because I don't know the encoding on the remote server.
You can now link different images galleries together into a single one :).
If you want to add custom configuration files like config.php or style.css: They have to be in the local directory where the url.txt is. Remote configuration files are not supported.
NEW 1.5 - Now you can provide a page by yourself (e.g. an index.htm in a folder) that has only full links (e.g. http://www.123.com/images/image1.jpg) to your images. TWG does detect full links and fetches the images from there. This makes it possible to link to any image you like and put them together in one directory!
NEW 1.7.7 - You can use relative links! This means you can link to directories that are not below the pictures directory. Enter the relative path in the url.txt. The path has to be relative to the main directory of TWG + you have to add one ../ in the front! Only images, external videos like yotube and flv are supported. WMP and DIVX are not supported!
Example: if TWG is installed in the directory /twg and your image folder is at /images/myalbum then you have to add ../../images/myalbum/ in url.txt.
21. How to add a "home" link to the gallery and how to create independant sub galleriesNEW 1.7.0.6 - I have rewritten the implementation of root.txt to make it easier to handle! The howto is only valid from this version and above.
A root.txt can be used for 2 things:
New 1.7.6 - Multi root mode. If you only want to have independant galleries this is maybe the easier solution for you. See howto 52 for details.
22. How to use a different background image for each folderYou can use an individual background image for each sub folder. Simply place a png called back.png in the folder where the background should be different. That's it.
If you want to save some disk space and make your gallery a little bit faster - use a jpg as background an rename it to png!
You can turn off background images in the config.php with $show_background_images. There is also a switch called $low_show_background_images that is used in low bandwidth mode. By default background images are not shown in low bandwidth mode.
Please note: TWG does dynamic resizing of your background images unless you disable this in the config - see $use_dynamic_background and $use_resized_background!
23. How to upgrade from older versions from TWG Deutsche Version siehe weiter unten!
If you want to upgrade from an older version than 1.4 you can still use your counters, captions and comments. But don't use any of the other files. Please make a clean install!
You should use a file called my_config.php! Put your changes you want to make in config.php into this file. They overwrite all variables from the config.php. I you want to upgrade to a new version or just want to install TWG somewhere else you have all your changes in one nice small file!
If you want to use the installer for updating please read how-to 31
UPDATE TO 1.6:
I recommend that you make a clean installation if you want to update to version 1.6!
UTF-8 should be the preferred encoding because TWG is now available in over 20 languages and this is the only way to have a consistent system that works all over the world!
UPDATE 1.6 TO 1.7.x:
Here no big structure change was done! Backup my_config.php, my_style.css, admin/.config/.htusers.php, the counter, xml and your pictures folder to the new installation. Simply overwrite the other files! I have added a new function (edit/view) of files. There is a new right in the backend. Check if the permissions are still o.k.
On the download page is a patch file where you can simply overwrite all existing files!
Deutsch:
Da Updaten wohl sehr wichtig ist, gibts dieses howto auch mal in Deutsch ;). (Übersetzer für den Rest gesucht ;)).
Um auf 1.6 zu aktualisieren empfehle ich eine Neuinstallation, da sich auch Verzeichnisse geändert haben.
Der Umstieg zu utf-8 war notwendig, das TWG jetzt in über 20 Sprachen verfügbar ist und nur so ein konsistentes System möglich ist.
UPDATE 1.6 nach 1.7.x:
In dieser Version gibt es keine Strukturänderungen. Sichert my_config.php, my_style.css, admin/.config/.htusers.php das counter, xml und euer Bilderverzeichnis. Überschreibt die anderen Dateien: Fertig! Es gibt ein neues Recht in der Administration (editieren von Textdateien). Bitte überprüft, ob die Rechte für euch weiterhin in Ordnung sind.
Auf der Downloadseite gibt es ein patch file, wo man einfach alle Dateien überschreiben kann.
24. How to show more images in the DHTML thumbnail strip If you scroll in the DHTML thumbnail strip you can set the numbers displayed at a time with $numberofpics.
But here I want to "remove" the green arrows at the end of the thumbnail strip. The problem here is that all pictures have to be loaded until the strip is moving. To decrease the waiting time I have set a limit of the number of images which are displayed with the following two parameters:
$cmotion_gallery_limit_ie=40;
$cmotion_gallery_limit_firefox=20;
This is the max number of images that are shown in one cmotion gallery. At the end there will be a small arrow to go to the next x images :).
But why are the numbers different? All browsers except IE don't allow to exchange images in this strip on the fly. Therefore an optimization for IE exists: $enable_optimize_cmotion_gallery_limit_ie. If you set this to true only 5 images are loaded each side and all the remaining ones are white first. Because IE does allow me to exchange these images I can do some nice background exchanging of this images - The big advantage: The gallery is moving if the 1st set of images is loaded.
Sometimes some images don't show up in the optimized version. Most of the time this is because the thumbnail had to be generated and was not available in time when IE requested it. If all thumbnails are created this is no problem anymore. (You can use the search to create all thumbnails quickly -> search -> file name -> . -> All). So if you want to reduce the green arrows: increase this values but not that a lot of data is loaded. There are low_ values for this two settings as well!
25. How to use and make a skin!Using a skin is easy. Look in the skins folder which .css files do exist and use the name of the css (without the .css) in the config.php at $skin like $skin="winter";. If you download one from the forum extract it into the skins folder and enter the skin name like before in the config.php - be sure not to create a subdirectory. The skin files have to be in the skins folder.
Please read how-to 9 about colors in TWG!
Making a skin is actually easy too ;). The skin can have 3 components:
That's it. If you want to share your skin please check the "Skins" section in the forum. You should provide a screen shot and a zip file with the 3 files in it there. I have provided a template there how a entry in the skin section should look like.
Please don't use special characters or spaces for the skin names. Most web server don't work well with style sheets that contain those characters.
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
26. How to include different file formats like avi, mpg ...You can now include other file formats like mpg, avi, mp3... into TWG like you can see in the demos. TWG does not include the files directly but can provide a download for this files.
If you want e.g. include an avi you have to do the following steps:
If you change a watermark image or any setting for it you have to delete the cache! If you want to use embedded video or mp3 - please read howto 34
27. How to configure the hover effects for ie properlyInternet Explorer 6 (IE 7 is fine) has a problem with the style for a transparent border. Therefore you have to provide a background color if you like a hover effect around the thumbs on the details page. By default the border color for Firefox is transparent and for Internet Explorer it is set to none! If you use a background image I recommend not o use the hover effect but otherwise you should set the following 4 styles!
td.navicon a img{
}
td.html_side_default a img{
}
td.html_side_left a img {
}
td.html_side_right a img{
}
to e.g.
td.navicon a img{
border: 1px solid #0000ff;
}
The color manager provide this settings in the css if you don't use transparent for the main body!
28. How to use the image.txtPlease note:
image.txt is intended to add additional and maybe complex data to each image. It should NOT be used to create a caption below the image. TWG has the caption functionality for this. To add a simple caption below the image login in the right upper corner and on the image page you get the additional menu item 'Caption'. There you can easily enter a caption for each image. You can also add the captions right to your images and extreact them in TWG. Please read howto 38 about IPTC data for details.
The image.txt can be used to provide additional data in the detail page. Since 1.6 are 3 different "modes" possible. Before 1.6 only mode 1 and 2 are possible! Everything below works with the language dependent versions of the files as well - using e.g. image_de.txt, image_en.txt.
Which mode to choose: If you only want to display a static text for all images - use mode 1. If you need the image name dynamically but the rest is static - use mode 2. If you want to display a different additional text for each picture (not only captions) use mode 3.
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
29. How to configure the HTML_SIDE big navigationIf you want to display the thumbs on the image page right and left to the main image you can use the new HTML_SIDE navigation.
Just set $default_big_navigation="HTML_SIDE";
There are 4 more parameter where you can configure the display of this style: $numberofpics_html_side, $disable_nav_big_sel, $html_side_break, $html_side_space_optimization and
$html_side_show_dividor. Please read the documentation behind this settings to configure HTML_SIDE.
If you have $numberofpics_html_side-1 images in a directory a special mode is enabled. e.g. if this is set to 9 4 images are shown on each side! to make this style look good the 8 thumbs are static! The actual thumb that is displayed is only marked by a thin border! (style:html_side_mark)
30. How to use the TWGXplorer and what is the safe mode any why is this a problem ;)One of the main things of the backend is the TWGXplorer. You can upload, rename, delete, manage the files create users and gives them some rights .....
If the files have the permissions that you can access them with the user php is running you can do many of this things. If not you have to change the file permissions with an ftp program. Most of the time you need 777 for a file or directory you want the edit. This is because php is most of the time not running as your ftp user but a different user (apache, www-run ...)!
Please read the 2nd part about safe mode too - Quite interesting if you are not 100% clear about permissions and restrictions ...
I think this is not problem to understand ;). But there are 2 things I want to mention when using TWGXplorer: user management and restrictions because of the save mode!
If non of this solutions work I do recommend not to upload or edit files with the TWGXplorer and to use a FTP program. TWG does not detect all restrictions of the safe-mode and therefore it is sometimes possible to delete a file or folder even if the actions on the right do not allow this. You can select the checkbox on the left and use one of the commands on the top and try if it works.
Please read this if you want to use the installer version of TWG AND safe mode is on:
The installer version of TWG can be installed only in a subdirectory that is created by TWG. You have full rights with the TWGXplorer. But the safe mode does not allow you to access pictures you have uploaded with your FTP program! Therefore you have to decide what you want! Upload with the TWGXplorer or FTP. If you want to upload your files with an FTP and have safe mode on please use the normal version of TWG (or simply extract the twg_install.zip and upload everything with your FTP program)
If you have read this and have still no idea what i'm talking about please let me know - I want to make this quite hard topic as understandable as possible.
31. How to update TWG with the installerIf you want to update TWG to the latest version you have to have TWG 1.4.x installed already. It is not possible to use the installer if you use an older version. I also recommend not to update any 1.4.x or 1.5.x version to 1.6 with the installer because I have changed some directory structures and your install would get messy! + you have to copy admin/.config/.htusers.php manually to admin/_conifg/.htusers.php.
Then you have to have all your changes to TWG either in the my_config.php, the my_style.css or of course inside the pictures folder! If you have made modification e.g. in the config.php - move them to the my_config.php and do the same with style.css and my_style.css.
And Safe Mode should be off. If it is on the installer will tell and warn you! If you have done the installation with the installer before - go on. If not TWG will not update but install TWG into the sub folder twg. I think you don't like that! Please use the normal zip version then.
Updating itself is very easy
I have tested the installer on many systems and I never had any data loss (either it worked of it was not working at all because of php security settings!) but I always recommend to make a backup! On some servers the unzip does not overwrite existing files! If your update does not work: use the zip version and make a manual update.
Have fun updating TWG!
32. How to add big folder descriptions like in the AJAX demo - registered version only You can add folder descriptions to the left and right of the folder images/collage. You can use two files where you can put your html - albuml.txt (for left) and albumr.txt (for right). The files are included in a <td class="albumtxt"> ... </td> tag. You can use a div inside to get a nice layout. You can use language dependant files too like albumr_de.txt.
e.g. <div style="width:250px;text-align:right;padding-right:20px;"> your text </div>
If you want to link from your text to the album like before you have to manually add the link to your text (copy it from the link from the images).
You have to set $menu_x to 1 or 2. If you use album.txt files the normal folder description is not displayed anymore!
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
33. How to use the lightbox feature (new 1.4.2)- registered version onlyTWG has integrated the lighbox script and lytebox script (since 1.7.4) for registered users. This feature can be activated at 3 points:
You can set this parameters in the my_config.php (copy them from config.php) or add them in the additional tab of the TWG Admin configuration. Please do not modify my_config.php if you want to manage TWG with the TWG Admin because otherwise you settings get overwritten! If you want to change the colors of the lightbox script please change the lighbox/css/lightbox.css.
Thanks to
Lokesh Dhakar for the Lighbox script + the users from the blog that added some nice features to it (+ me who added some more features ;)).
Since 1.7.4 the lytebox script is the default lightbox because it supports if you have TWG in an iframe.
To use the lytebox in an iframe you have to include the lightbox/lytebox.css into the head section of your main page with e.g.
<link rel="stylesheet" href="twg/lightbox/lytebox.css" type="text/css" media="screen">
if TWG is installed in the directory "twg".
Have fun using the lytebox.
34. How to use embedded video support (new 1.5 + extended in 1.6 + reworked in 1.7)To enable embeded video you have to create a file called video.php in the folder where the videos are or should be shown! If the file video.php is empty then the default settings in the config file is used. You can put the settings for this folder in the video.php file too (<?php [your settings] ?>). In the sections below you can see examples settings for each type.
Thumbnails:
You have to have a preview image for each video in the folder! They are needed for the autodetection mode as well!
The name of the thumbnail file is different depending which type your are using (See below). But most of the time it has the same name like the video and instead the extension of the video the needed extension is jpg. You can prodvide this the following ways:
Without thumbnail your video will not be shown!
New 1.7: Autodetection - Please read this part first!
I reworked the video detection for local videos! It is now possible for TWG to auto detect local videos like flv, divx, mov, avi, mpg, wmv!
You have 2 options:
Solution 1 and 2 are treated almost identical internally. Solution 2 is a little bit more flexible because you can do some extra settings like disabling the slideshow.
Using the auto detection makes it possible to mix videos AND images in one folder if the videos are local. Read Howto 39 if you don't have local videos!
You have to use solution 2 and set $default_big_navigation="HTML"; in the video.php!
Since 1.7 it is also possible to generate a video.php and a preview image during the upload of a video! Even automatic conversion toflv is possible. Check $use_ffmpeg and $autogenerate_video_php_at_upload and the settings below. This makes it possible that users can upload a video and everything needed is generated automatically. This feature is only available if you have ffmpeg available (check info.php). Please read howto 47 if you want to use this feature!
The disadvantage of the auto detection is that the HTML mode has to be used because different video types can be in one folder and each type needs a different treatment.
The best video inclusion can still be achieved by using specialized video.php's like described below because there you can control everything and it's possible to use the DHTML (=Ajax) mode.
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
1. Embed a streamed video with a flash player
If you want to use this solution the video is not stored on your web space but on one of the video sites below. You have to create an account there and then upload your file. Then you can directly view your video on this site. Depending on the site the video is then available for all other users of the site too. Some of this sites provide private access as well (see below for details). TWG does then embed the video directly from this site and provides the flash player that does support streaming. TWG can mark your thumbnails with an watermark - to make this work for this solution simply create a file with the same name as the thumbnail and with the extension of your video (e.g. .avi see howto 26 how this works).
Advantage:
- You don't need your own web space
- You get a streamed video - this means that the video has not downloaded completely before the playback starts.
- The video is converted by the uploaded site in the needed format.
Disadvantage:
- On most of this providers your video is visible to all.
- You have to upload the video to this providers first.
- You cannot provide a download link - the setting
$video_show_dl_link has to be set to false.
SORTING: I have included a solution to sort this videos. Because the names are given by the web sites you can use a prefix for the thumbnails. The prefix has 3 numbers + 3 underscored (___) .e.g. 001___<imagename>.jpg
2. Embed a streamed video with the Divx Web Player
Another nice solution is to use the Divx Web Player plugin. The viewer of the gallery has only to download the plugin to view the videos. If you check the demo you find one folder where you can see this working. The nice thing about doing this is if you use this plugin and tell divx about this you get a free licence for the divx creator ;). Most likely this is the solution with the best video quality.
TWG will mark your thumbnails with an watermark because the .divx extension is already a know extension (see howto 26 how this works). The videos are stored at the same web space as TWG and the Divx player does nice streaming of this video too.
Advantages:
- The player streams the video from your web space without a streaming server - this means that the video has not downloaded completely before the playback starts.
- The videos are not converted somehow and located on your web space.
- You control the quality of the video.
- You can provide a download link if you like
- You can use autostart or not!
Disadvantage:
- The Divx Web Player plugin has to be installed (available for Windows and Mac)
- You need quite some web space if you store the videos.
- Opera 9 does no support the dynamic switching between the videos. Therefore you have to use HTML or HTML_SIDE if you want to support all browsers
To use the Divx plugin you have to provide a thumbnail jpeg. The image has to have the same name as the divx video. And the divx video has to have the extension .divx. Simply put them in the same directory.
You have to provide a video.php that looks like this (change the sizes):
3. Embed a video with the Windows Media Player
You can simply use the windows media player to play embeded video. You can play any file type hat can be played with the WMP (avi, wmv, mp3 ...). The big disadvantage is that the video is not streamed by most servers. I have implemented a solution that works with play list files (movie.wvx). I have found many web sites where they say that the wmp does then stream when this play list file is used. But on my local system it does not :(.
Advantages:
- Because most users still have windows many people don't have to download an extra player
- The videos are not converted somehow and located on your web space.
- You control the quality of the video.
- You can provide a download link if you like.
- You can use autostart or not!
Disadvantage:
- You can not enlage the videos! The player should have the size like the videos. IE works fine but Firefox not. Therefore I disabled the resite for IE to get the same display for the main browsers! If you don't want this you should use the FLV player.
- You are using the Windows Media Player and I think most users have to download the video first before they can watch it : means no streaming!
- Only systems where the WMP is available can play the videos (= Windows!). But users already reported that they got this working on Linux too ;).
- You need quite some web space. if you store the videos.
- On browsers where the WMP Plugin does not work properly the videos don't play - I have never made it to get Opera 9 to load the plugin. You can e.g. try on www.orschlurch.de. They have lots of videos embedded with the WMP. If your browser does not work there it won't play it on TWG either.
To use the WMP you have to provide a thumbnail jpeg. The file name is the one of the video. If you have a thumbnail called xxx.jpg the video name has to be xxx.wmv. Simply put them in the same directory ;).
You have to provide a video.php that looks like this (change the sizes):
4. Integrate wmp streams like web radio and video streams. (new 1.6)
You can simply use the windows media player to play external video streams and web radios. The only thing you need is the url to the stream itself. As an example I use the stream of the german radio swf3. The steam is
http://lsd.newmedia.tiscali-business.com/bb/redirect.lsc?stream=swr3/livestream.wma&content=live&media=ms
To include this stream you have to provide a preview image and follow the following rules:
In the example above this is:
lsd.newmedia.tiscali-business.com___bb___redirect.lsc_Q_stream=swr3___livestream.wma&content=live&media=ms.jpg
Since 1.7.5: lsd.newmedia.tiscali-business.com_S_bb_S_redirect.lsc_Q_stream=swr3_S_livestream.wma&content=live&media=ms.jpg
You have to provide a video.php that looks like this (change the sizes):
In the demo gallery there is a folder that shows a couple of streams ;).
The folder where this streams are shown have to be writable by php because the wmp is saving a play list file (wvx) to this directory.
5. Embed a flash video with the local flv player (new 1.6)
TWG does now support the direct usage of the original flash player (flvplayer) that is used by youtube.com and many other video sites as well. This makes it possible that you don't have to upload your videos to e.g. youtube.com or myvideo.de but have it stored on your own web space. On the other hand you have to create the needed flv videos by yourself! An excellent free encoder for this is the RivaEncoder (download it here).
The setup of the filenames is very easy. For a video called video.flv you have to provide a file called video.jpg (please note that the TWG Admin can create default images for this type of video). Make sure that the file extension .flv is lowercase!
Advantage:
- You get a streamed video - this means that the video has not downloaded completely before the playback starts.
- The video are locally stored.
- The video does play on every platform where flash is available
- You can provide a download link if you like
- You can use autostart or not!
Disadvantage:
- You have to convert your videos to the flv player. I alway use the freeware 'Riva FLV Encoder'.
- The player is not part of TWG. I have only integrated it! It is free for non commercial use - if you want to use it for commercial use you have to register the flash separately at www.jeroenwijering.com. If you register the flash please add a note to the registration that you where using the player in TWG (+send an e-mail to me) - If more users do register the flash I maybe buy a unlimited license for TWG and include it for everyone!
You have to provide a video.php that looks like this (change the sizes):
<?php
$video_size_x=300;
$video_size_y=170;
$video_player="FLV";
$video_flash_site = "";
$video_autostart=true; // true and false works
$video_show_dl_link=false; // true and false works
$video_flv_buffer=2; // this is the buffer is s that is filled before the video starts - This parameter is new in 1.7.8.1!
?>
Remote flashes are not supported here - use one of the flash solution before if you like to do this!
6. Embed a quicktime (.mov) video with the Quicktime player (new 1.6)
You can include Apple Quicktime movies in TWG now as well. You only need the installed Quicktime player installed.
The setup of the filenames is very easy. For a video called video.mov you have to provide a file called video.jpg (please note that the TWG Admin can create default images for this type of video). Make sure that the file extension .mov is lowercase!
Advantage:
- The video are locally stored.
- The video does play on every platform where quicktime is available
- You can provide a download link if you like
- You can use autostart or not!
Disadvantage:
- You need .mov files of course ;).
- The videos are not streamed right now - quicktime would support this if you have a streaming server for quicktime.
I don't have this server
- therefore you have to change the code by yourself in inc/videostreaming.inc.php
- Javascript is needed - there is no non Javascript fallback right now
- Only a white background is possible on all browsers if the resolution of the video is smaller than the size of the player!
I have set the style class .transparent but this setting only works in Firefox.
You have to provide a video.php that looks like this (change the sizes):
<?php
$video_size_x=320;
$video_size_y=210;
$video_player="QT";
$video_show_dl_link=true;
$video_autostart=true; // true and false works
// extra settings to make it look nicer
$show_rotation_buttons=false;
$small_pic_size = 220;
?>
7. Embed streamed mp3's with the flash player that comes with TWG
If you want to embed mp3's I recommend to use my steaming flash mp3 player that comes with TWG. The player is a modified version of the FX-player where I have removed the stuff that is not needed by TWG and changed the layout a little bit. Many thanks to the authors of this great free player.
Advantages:
- You get a streamed mp3 - this means that the video has not to be downloaded completely before the playback starts.
- The mp3's are not converted somehow and located on your web space.
- You control the quality of the mp3's.
- You can provide a download link if you like.
- The player is very small, quick and good looking ;).
- You can use autostart or not!
- You can store the mp3 on another web space.
Disadvantage:
- You need quite some web space. if you store the mp3 local (but you can store them remote too ;)).
To use the mp3's you have to provide a thumbnail jpeg. The image has to have the same name as the mp3. Simply put them in the same directory ;).
If you set $video_flash_site to the location of your mp3's you can even store the mp3 somewhere else. If the mp3 is on http://www.example.com/mp3/mysong.mp3 then $video_flash_site has to be set to "http://www.example.com/mp3/". The url has to start with http!
Please note: It is not allowed to have special characters (like äü ...) in the path and filenames of the mp3's - the flash player does not handle them properly. btw. spaces or () are fine!!
You have to provide a video.php that looks like this:
Additionally you can provide the $video_flash_site on am remote server. Then you can use something like that:
The provided filename will then be added to this url. Download does work as well for remote mp3's.
You can even mix local and remote mp3's. Provide the remote link to the mp3's - and then put your local files to the folder like normal. For the remote file you provide an empty file with the correct naming.
SORTING: I have included a solution to sort mp3's. You can use a prefix for the thumbnails. The prefix has 3 numbers + 3 underscored (___) .e.g. 001___<imagename>.jpg and then the mp3 is 001___<imagename>.mp3. If you use external mp3's this mp3's don't have this sorting prefix!
PHP INCLUDE : If you use php include you have to copy the twg_audiolist.php into the folder where the file you include twg is located. Then you have to edit twg_audiolist.php and edit the parameter $xmlfilename that it points to the cache folder (adding the parameter of $install_dir). In newer versions of TWG you don't have to edit twg_audiolist.php anymore. So please try without this modification first.
What should I use?
Now you have many ways to provide multimedia content - which one should you use? I think you can use all ways and still be happy. I think first it depends which video source you have. Then if streaming is important for you - if you have bigger videos I would only choose a streaming solution!
You can actually include most of the video sites available. Simply check the url's they use and then use the dynamic part of the url as file name of the preview jpg.
And now have fun using TWG and videos!
35. How to choose the right storage location for your xml filesSince 1.5 the xml files (where the comments, captions and counters are stored) can be saved into the album where they belong to. Before 1.5 all xml files where only stored in the xml folder. By default the xml folder is still used because you should read this howto before to make this work ;).
1. Storage in the xml folder
By default the xml files are stored in the xml folder. The advantage is that only the xml folder has to be writable and all xml files can be found at one place. The big disadvantage is that if you move or rename a folder the xml file names have to be changed manually to keep the data.
Since TWG 1.7.7 you can create a text file called folder.id with a unique id in your image folder. Then the unique id is used as prefix in the xml folder and not the album name. If you do this you can then move or rename your albums without any problems. Just be aware that this files has to be created when you create the directory. There is no migration if you create it later!
Since TWG 1.7.8 you can TWG let create the folder.id automatically - set $autocreate_folder_id = true; Currently this is not set as default. In one of the next versions I will change this. Make sure that the folders below the pictures folders are writable.
2. Storage in the album folders
If you store the xml files in each album the albums have to be writable! This can be a problem because many folder have to have the right permissions (not only one like in the xml folder). The big advantage is that you can rename and move albums and still keep the data. And it's much easier to find the right xml file if you want to change one manually
The info in the TWG Admin does always show you if all directories are writable and if not lists the directories that have to make writable. If you change from the xml storage to the album storage the xml files from the xml folder are automatically transferred in the album folder. But there is not transfer back!!!
IMPORTANT: It's a step by step process - it's transferred when an xml is modified! Therefore it's moved when you change a caption of an comment of a folder (then all xml's for a folder are moved! (1.6 it's different!))
And now the important switch: $store_xml_in_picfolders
NEW 1.6: In 1.6 I have reworked this part because migration could take very long this way. I have now added this functionality to the pre caching of the xml's. This mean you have to do the following steps to migrate:
36. How to uninstall TWG if you cannot simply delete itBecause of safe mode restrictions if is possible to set the permissions of directories that way that you cannot change it back and this can lead to the problem you cannot delete your TWG installation anymore. This can happen quite easily if you use the TWGXplorer or the installer and some directories or files are deletable by php but not by you ftp program. Therefore I implemented a small uninstaller.
To uninstall TWG ONLY if you cannot simply delete it with FTP do the following:
37. How to use the new backend rightsYou can now give the users different rights. Please note that the rights always depend on the home directory of the user. The default should be the pictures directory! It's not possible to have more than one main pictures folder (of course as many sub folders ;)). Therefore you always should start at least with "pictures" as main directory for all users that should not access the TWG installation itself!
There are now 4 rights available:
The big difference to 1.5 is that there is not a simple password in the front end where you could enter captions ... anymore. Now it's possible to create a user and give them specified rights to specific directories. A special feature is that if a user has "Frontend Upload" rights. Then he gets a new menu item "Upload" when he is in a directory where he has the rights to upload. Then this user can access the TWG Upload Flash with the rights you gave him ;). In the frontend no html upload is possible.
This new user management makes it possible that you can have one gallery that is filled with content from different people where everyone can only access his area.
38. How to use ITPC data in TWGTWG does now read of IPTC data from the images. This is meta information that you can easily add to your images. Good programs to add/edit ITPC data are:
. TWG uses this information at several places:
To avoid reading this info every time a picture is displayed (which would be quite slow) this reading is done when:
The IPTC data fields are tested with Photoshop and XnView. But if you have a different tool where my offsets (the one I have chosen are the most common ones e.g. 2#120 for Description) do not work you can simply change the offsets in the config ;).
Almost all images in the Ajax demo contain IPTC data! If you download the examples and go to the TWG Admin and extract the IPTC data you get a lot of tags and captions already ;).
Exif for caption
You can use Exif information for caption too. This is quite uncommon but e.g. the software "Exifer" and
Photoshop Album 2.0
(someone told me) stores e.g. an image description in the exif data. By default reading this info is disabled because it is really slow (about 10 times slower than reading IPTC data). To enable reading data and use this as caption you have to set $exif_field_for_caption to the exif key in the config. "imageDesc" is the key where the image description is saved often.
To find out which keys are in your images you can make a dump of the exif data. Open inc/exif.inc.php, search for "print_r", remove the // at the beginning of this line and store the file again. Then go to the gallery and open the info of an image. Then check the counter/_mydebug.out. There you find a list of all exif keys. Simply use the one you want to extract and don't forget to restore the exif.inc.php.
New 1.7: you can extract a 2nd exif field for the caption - check the parameter $iptc_fields_for_caption_add
39. How to mix images and videos in one folderSince 1.6 you can have one type of video and images in one folder! This only works in the HTML and HTML_SIDE mode - If you set this to true then DHTML mode is switched to HTML mode! Therefore I recommend to set this to true this ONLY in the video.php!
Add $mixed_video_image_content=true; to your video file to enable the mixed mode!
If you set this to true you have too add v___ (3x _) at the front of the filename of the video (this is prefix is use by TWG to detect that this is a video). This prefix is removed when a caption is displayed! e.g. 123345.jpg -> v___123345.jpg. a sorting prefix goes BEFORE this 123345.jpg -> 123___v___123345.jpg.
There are 2 example folders in the Multimedia album of the Ajax Demo.
New 1.7: You can use the auto detection of videos instead using the description above if you have local videos. Please go to howto 34 and read the section about auto detection!
40. How to include PNG's and GIF'sThis a quite easy howto:
41. How to generate preview images for extra file types! - registered version onlyBefore TWG 1.6 you have to provide a preview image for every extra file type like wmv, pdf, flv. Since 1.6 you can generate default preview images in the TWG Admin.
All images that get a default preview image that are defined in the array $other_file_formats_previews.
Right now the following file types are defined: avi, mpg,mpeg,pdf,mp3,divx,wmv,wma,flv,mov.
They all have the preview: buttons/border.jpg.
Because these types are all defined in $other_file_formats they will get a watermark! You can change the watermark in the array or define no watermark
New 1.7: for video files it's possible to use ffmpeg to generate thumbnails out of the video - see how-to 47.
42. How to check and enable file splitting (new 1.6)I have tested the TWG Upload Flash and the TFU File Split Applet on several systems and not all servers do support this kind of upload (e.g. funpic.de does not - my TWG server does). The test is quite simple - you have to upload a file bigger than your file upload limit and TWG has to be able to process it. I have written a small howto with the steps you have to do:
43. Wie funktioniert der Cache in TWGTWG cacht eine Menge um die Galerie zu beschleunigen. Es gibt verschiedene Levels des Cachings:
Bitte beachte: Wenn Du auf das Bandbreiten Icon klickst, werden die Daten des 1 Tages Cache, des X Stunden Caches und die Sitzung gelöscht! Wenn der Cache nicht aktiviert ist, kannst Du diesen durch einen Klick auf "No Cache" für diese Sitzung aktivieren! Dann kannst Du sehen um wieviel schneller die Galerie angezeigt wird ;).
Zusammenfassung:
Während der normalen Nutzung solltest Du den Cache immer aktivieren, da ansonsten der Server vielmehr zusätzlich zu arbeiten hat. Nach der Installation ist der Cache deaktviert (man sieht es in der rechten unteren Ecke) da man während der Einrichtung Änderungen in den TopX auch sofort sehen möchte. Sobald dies abgeschlossen ist: aktiviere den Cache. Hochladen von Bildern mit dem Flash Uploader aktualisiert automatisch diese Caches!
44. How to enable url rewriteIf you want to link directly to albums or directory you can copy the link in the browser. But this link is not very nice and user friendly. If you want to provide nicer url's you can use url rewrite to do this. Rewrite is done by using a .htaccess in the main folder of TWG. In the examples folder is a zip called url_rewrite.zip. There you find an .htaccess with a simple rewrite rule. You can then link to a gallery by using e.g.
http://www.tinywebgallery.com/demo/twg_album/05_exif
instead of
http://www.tinywebgallery.com/demo/index.php?twg_album=05_exif
or to an image by using
http://www.tinywebgallery.com/demo/twg_image/05_exif/1.jpg
instead of
http://www.tinywebgallery.com/demo/index.php?twg_album=05_exif&twg_show=1.jpg
All the example above to work! I have added a .htaccess file like described below to the AJAX demo of TWG
The template in the .htaccess is:
Thanks to Miguel for this!
45. Wie wird die Galerie auf Geschwindkeit optimiert Standardmäßig sind die meisten Features der TWG aktiviert. Wie Du Dir denken kannst sieht das so am besten aus, ist jedoch nicht auf Geschwindigkeit optimierte. Diese kleine Howto zeigt Dir wie man mit einigen Parametern die TWG optimieren kann wenn D denkst das 95% cool sind und TWG zu langsam ist ;). Bitte beachte - TWG nutzt eine Bandbreiten Erkennung. Wenn eine langsame Verbindung erkannt wird werden generell die low_ Einträge der Konfiguration benutzt. Dieser Modus deaktviert einige Features welche wirklich viel Bandbreite benötigen (wie die Collage, feste Anzahl der Thumbnails, verstecken der großen Navigation ...).
Dies ist derzeit alles wo ich meine das dies einen Unterschied ausmacht. Du kannst noch eine Menge anderes tunen jedoch glaube ich nicht dass Du einen Geschwindigkeitsunterschied merken wirst wenn Du dies tust. Wenn dir langweilig ist: schaue einfach in die config.php und Du kannst was Du alles in der TWG konfigurieren kannst wenn Du magst ;).
46. How to use image magick (New 1.7)Since 1.7 TWG does support image magick for:
This are the files that are actually written to the hard disk. Image magic is not used for the slideshow, random and all maximized images. This calculations are still done with gdlib.
You can check if you can use image magick by calling the info.php page. If there is not support you have to install image magick. Ask your hoster or google (if you can install software on your server!) how to do this ;).
Using image magick has the advantage that is needs less memory than gdlib and produces a better quality (but the difference is not very big as far as I can say). If your images are very big and you don't have much php memory than you should try to use image magick. You can enable image magick by setting $use_image_magic=true;
If image magick does not work error images are shown. You have to delete the image cache after changing image magick settings or if you turn the support off when it does not work.
47. How to use ffmpeg (New 1.7) ffmpeg is a very powerful tool to convert videos and to extract thumbnails from videos. TWG can use ffmpeg to:
First you should check if ffmpeg is available by calling the info.php page. If it is available you can use all the settings below $use_ffmpeg. Please read the documentation in the config.php in the details. There you can specify the extensions, the time where the thumbnail is extracted and a couple of other settings for ffmpeg.
If you don't have ffmpeg installed but you want to use ffmpeg you normally need a private or a virtual server because I don't know a hosters that install ffmpeg on a shared server (If you find one - tell me). Under Linux the install is not very easy. I had to install 12 rpm's under fedora 4. But check your distribution first. Maybe the auto installer can install all dependent rpms (I have read that debian does this). Under windows a native port does exist. It's only one exe file and a dll. Really easy to use ;).
48. How to use self registration (New 1.7) Since 1.7 you can allow people to create a frontend account for TWG. This user get a directory and can upload the images there. Only usernames with [a-z,A-Z,0-9,- and _] are allowed because of security reasons - please note: You are responsible for the stuff your users upload!
The following settings are available to configure self registration:
Right now only English and Geman translations are available. If you use this function please translate it and send me the translations.
49. How to use the thumbnail flash (New 1.7.3)Since 1.7.3 there is the new thubnail flash available. To enable the flash you have to either select "Flash" in the Administration -> Configure TWG -> Functionality -> Default big navigation or set $default_big_navigation="FLASH" in my_config.php. Additonally there are the following options are available:
You can copy them to the free text field in the administation or in my_config.php
Have fun ;).
50. How to make round corners (New 1.7.5)Since 1.7.5 TWG gives you the possibility to have round corners around the image area. This is completely done by Javascript. You don't have to create any extra images for this!
An example how this looks like is shown in the admin skin. To enable this you have the following settings in the config (copy changes to my_config.php (or the freetext field in the administration) as always):
Known restrictions:
I'm looking if I do find a better solution without the restrictions. But if you don't use php include the fallbacks do look like before and if it is supported it looks better.
Now you have to set the styles for the corners. Simply create a file called <skin>_round.css and put in the settings below and adopt the colors as described:
/* Set the color of the border */
#content_div .sb-border {
background-color:#ccc;
}
/* Disables the old border AND set the color to the color of the border of TWG (the background of the header part. ) */
td.twg_info { border: none; background-color: #fff; }
You find working examples in the skin folder. You should always make a skin if you want to use it because e.g. for Opera I disable this feature.
Now you should have nice round borders around TWG ;).
Have fun ;).
51. How to add captions to an imageIf finally wrote this small howto because too many users asked me how to add captions to an image. There are the following ways:
52. How to use the multi root mode (new 1.7.6)This mode can be used if you like independant galleries in one TWG install where each subtree should look like it's own gallery. Before you could do this by creating a root.txt in each folder. But this had some restrictions which don't exist now anymore:
You can enable the mode by setting
$multi_root_mode=true;
You the have to link directly to the album with: <path to the TWG install>/index.php?twg_album=<your foldername>
Without a folder you get an error message that you are not allowed to see the root.
If you want to secure this directory then you have to do the same like described below in the JFU + TWG scenario.
JFU + TWG
An interesting combination is to use JFU with the module of TWG. In JFU you can create profiles for your users (or use a master profile with the login name as sub directory name) and point the directory to the pictures directory of TWG.
The module of TWG (it's in the joomla-mambo directory) does set the current login of Joomla to the session variable 's_user' and you can enable in the module that the login is automatically added as twg_album parameter. Then the user directory is shown in the module. Finally you have to set the parameter
$multi_root_mode_login='';
to
$multi_root_mode_login='s_user';
in the configuration of TWG. By doing this setup every user get's his own little gallery nicely included in Joomla.
If you leave $multi_root_mode_login=''; no session check is made. Then you can access an album by knowing the url. If you want to give the user the posibility to share their images without login this is usefull.
If you don't use the multi root mode you can still use the TWG module to make a direct link to the users directory.
About including a module in the content area: If you don't have a module position where you can include TWG you can include it by following this tutorial of loadposition. For 1.0.x users: google for mosmodul.
53. Howto configure your server to run TWG properlyIit's quite important how you configure your server to get TWG working properly. On the configuration page the first thing I tell you is the call info.php. And this is the howto how to change this settings.
So first call info.php and check the settings you see there. This are the settings you have set on your server in your php.ini.
The php.ini is your php configuration file of your server. It's not part of TWG/TFU/JFU and you have to make changes there to increase the limits. There are several locations where the php.ini files is/can be.
The usage is really simple. You overwrite the settings from the default php.ini with the settings you set in your custom php.ini
This are the most interesting settings:
TWG:
Upload in TWG/TFU/JFU:
A simple example for a custom php.ini for TFU would look like this.
memory_limit=64M
upload_max_filesize = 20M
post_max_size = 20M
max_input_time=1800
max_execution_time=1800
default_socket_timeout=1800
This defines a 20 MB upload limit, php memory of 64MB and timeouts of 30 min. There are most of the time maximum limits by your hoster you cannot exceed. Therefore you have to ask your hoster if you cannot increase the limits to the value you need..
For a complete list of settings that you may configure in the php.ini file, please refer to the PHP manual page found at http://www.php.net/manual/en/ini.list.php. Please be informed that the php.ini file does not require all of these settings; only enter the line that you wish to change from the default value.
When changing the maximum file upload size, please ensure you have changed both the upload_max_filesize and post_max_size configuration together. The two settings should share the same value.
If you have an ISS as webserver please read this post: http://www.tinywebgallery.com/forum/viewtopic.php?t=2295
54. How to set a background imageThere are a couple of ways how to define background images in TWG. TWG does also support dynamic background images which means that the background images gets resized dynamically to the browser dimensions.
If you use the color manager you can select different example images. Make sure to use the 'color' transparent for the areas you want to see the background images. The background image cannot be defined directly in the color manager and has to be set like described above.
I'm using TWG 1.5 and my cmotion thumb strip is not moving anymore! Before 1.5 the cmotion gallery was always moving if you had dhtml mode enabled - since 1.5 this is not the case anymore! this can have one of the following reasons:
I'm using TWG 1.5 and my cmotion thumb strip is not moving anymore! Before 1.5 the cmotion gallery was always moving if you had dhtml mode enabled - since 1.5 this is not the case anymore! this can have one of the following reasons:
TWG Admin does not work and all iframes are white If all iframes are white and the TWG Admin does not work then most likely a basedir restriction of your php installation is the problem. If you can speak german you can check the following thread in the forum: http://tinywebgallery.com/forum/viewtopic.php?t=399.
To make find out if this is the case add
ini_set("display_errors",1);
error_reporting(E_ALL);
to your index.php if no errors are shown in the debug file.
If you find something like that:
Warning: main(): open_basedir restriction in effect. File(./../config.php) is not within the allowed path(s): (/serv/www/data:.:/tmp/) in /home/gf1491/public_html/twg/admin/index.php on line 61
Warning: main(./../config.php): failed to open stream: Not owner in /home/gf1491/public_html/twg/admin/index.php on line 61
Then you have the basedir restriction. This means that you are not allowed to access a file from an upper directory. Please ask your admins to loosen this restriction because otherwise TWG won't work.
The images/directories are not shown at all or only some are shownIf you have set the right file permissions there can be a problem with your php memory limit. If you have original images with ~ 1MB the needed intern memory is ~10MB (Open a jpg e.g. in Paint Shop Pro or Photoshop and check the memory usage of your image). Call the file info.php in the TWG main directory. It shows you the php-settings of your system. If your memory limit is lower than the limit you need for your pictures you have to increase this limit or make your images smaller.
OR - If all images are missing: Have you enabled the "text on image" feature. If yes maybe the FreeType lib isn't installed on your system (call info.php section gd). Set $print_text to false and retry - If the images are shown please use the $print_watermark switch. I will try to detect if the print_text does not work in one of the next releases.
OR - TWG is caching everything from the file system in the session - close your browser and try again! Since 1.7.1 this cache checks itself if it needs changes!
Some of the images are completely black on the thumbnail viewYou have maybe opened the gallery during uploading the images. Just delete the cache folder and retry. Or the images cannot be read by the php library. I know some cameras that create jpg's that are not readable by the gdlib! If you can you should update your php installation > 5.1.3 - From there on corrupt images can be read much better - TWG sets all the flags that are needed to process these images!
Deleting the cacheDeleting the cache does not mean to delete all the files which are in there. It means to delete all the images that are in there! There are also .rot files where the rotation of images are stored :). If you want to remove stupid rotations - delete all files in this folder except the index.htm! Use the administration to delete the different levels of the caching!
You wrote that you removed all the cookies - but when I go to the gallery a cookie is set!That's right - TWG does not use any cookies to store information by itself but php does to track your session. If you don't allow this cookie you can't login or change any settings. But you can refuse this cookie and still use everything of TWG. TWG is designed to run without cookies if the php installation is setting a parameter in the php.ini. If the administrator of the gallery is able to set the flag 'session.use_trans_sid = 1' the urls get a sessionid. Then you can refuse the cookie and still use the whole functionality. If not you should allow your browser to accept this one cookie.
I want to sort my images by the date the picture is taken (using exif data) - what do I have to set on my server? TWG tries so sort your images after the time the picture is taken. Therefore it need to read exif information from the image. This function is only available in PHP 4 compiled using --enable- exif (call the info.php of TWG and check your php settings). Its functionality and behavior has changed in PHP 4.2. Earlier versions are very unstable. There are a couple of libraries in the www that can read the information without --enable- exif but I have tried some and didn't get better results reading the time the picture was taken (my own camera does not have exif data I can use :(). If no proper data can be read the file time is used. If --enable-exif is not set the file time is used as well.
How can I reset/change the image view counter/caption/comments?Maybe you want to reset/change the image view counter. The counter files are stored in the xml directory and have the format <twg_album>_image_counter.xml. Each directory has its own counter file. If you remove the file a new one is created the next time a picture of the twg_album is called. You can also modify it with a text editor to maybe reduce a stupid counter value.
The xml directory does also hold the captions (<twg_album>_image_text.xml) and the comments (<twg_album>_album_kommentar.xml). You can delete this files if you want to reset the entries. If you modify something with a text editor there please be careful because the text is stored encoded there (xml does not like something like & ;)).
I want to test TinyWebGallery at my system at home. Is there a easy way to do this?Yes there is. There is a great project called xampp that has a ready to go package of an actual Apache with installed PHP (and much more). Just go to http://www.apachefriends.org/de/xampp-windows.html and download the package. You have only to execute a batch file to start the Webserver (if you download the zip file!). Simply unpack the TWG into the htdocs directory of xampp and you are ready to go.
Exif information is not shown in TWG but the Windows Explorer does. Why?Exif information is stored differently by each camera type. The exif reader that is used is looking at a defined set of offsets and tries to extract the information. Windows explorer (and other tools) do just know more offsets than the small php class ;). I have this problem too depending which program I use to process my images. If the images don't work download the freeware version of cam2pc (http://www.nabocorp.com) and resize the image with the flag "copy metadata" set. Use as size a size bigger than your images if you don't want to resize! This nice tool copies the exif data to a place the exif reader con find it ;).
The exif reader is the same coppermine gallery uses. Therefore I want to thank coppermine programmers and the initial developer of the exif class who released this under the GNU General Public License!
Known restrictionsOpera: