The numbers of the howto's are the order I have created them. I simply could not change them because there are deeplinks from older TWG installs to this page. I have ordered each section how I think how important the howto is.
Summary Howto - Read this first!
Security & Optimization
- 1. How to make TWG secure
- 12. How to set passwords for a gallery (and how-to set multiple passwords for one gallery and why ;))
- 45. How to optimize the gallery for speed
- 43. How does caching in TWG work
- 11. How to link directly into a password protected gallery
Integration of TWG / Random image
- 2. How to include TWG into php sites or a cms system (like mambo, phpnuke).
- 3. How to integrate a HTML header / footer for TWG (different solution then how-to 2)
- 4. How to setup a random image or a topx image on a different site/frame
Installation & Advanced Setup help
- 23. How to upgrade from older versions from TWG
- 31. How to update TWG with the installer
- 10. How to check which php is available on your server and if TWG likes it
- 14. How to track errors if TWG does not work on your system.
- 30. How to use the TWGXplorer and what is the safe mode any why is this a problem ;)
- 35. How to choose the right storage location for your xml files
- 36. How to uninstall TWG if you cannot simply delete it
- 42. How to check and enable file splitting
- 46. How to use image magic (New 1.7)
- 8. How to create a language file.
Overview and thumbnail page settings
- 5. How to setup a folder image
- 6. How to set a gallery name different from the folder name (e.g. for enhanced sorting)
- 7. How to add a folder description (shown below the gallery name) or an image "header"
- 32. How to add big folder descriptions like in the Ajax demo- registered version only
- 21. How to add a "home" link to the gallery and how to create independant sub galleries
- 27. How to configure the hover effects for ie properly
Detail page settings
- 13. How to configure watermarks and/or text on an image.
- 28. How to use the image.txt
- 20. How to link to pictures in a remote http directory
- 16. Linking to a web site instead of downloading a file
- 19. How to enable download of a whole directory
Big navigation settings
- 49. How to use the thumbnail flash (New 1.7.3)
- 29. How to configure the HTML_SIDE big navigation
- 24. How to show more images in the DHTML thumbnail strip
Video
- 34. How to use embedded video support (new 1.5 + extended in 1.6 + reworked in 1.7)
- 47. How to use ffmpeg (New 1.7)
- 39. How to mix images and videos in one folder
- 41. How to generate preview images for extra file types! - registered version only
- 26. How to include different file formats like avi, mpg ...
Global stuff
- 17. How to use a directory based config.php
- 48. How to use self registration (New 1.7)
- 38. How to use ITPC data in TWG
- 33. How to use the lightbox feature - registered version only
- 18. How to enable e-mail notification
- 37. How to use the new backend rights
- 40. How to include PNG's (and gif's)
- 44. How to enable url rewrite
Layout and colors
- 50. How to make round corners (New 1.7.5)
- 9. How to change colors of TWG
- 25. How to use and make a skin!
- 22. How to use a different background image for each folder
- 15. How to change or extend the smilies
FAQ questions & problems
- I'm using TWG 1.5 and my cmotion thumb strip is not moving anymore!
- TWG Admin does not work and all iframes are white
- The images are not shown at all or only some are shown
- Some of the images are completely black on the thumbnail view
- Deleting the cache
- You wrote that you removed all the cookies - but when I go to the gallery a cookie is set!
- 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?
- How can I reset/change the image view counter/caption/comments?
- I want to test TinyWebGallery at my system at home. Is there a easy way to do this?
- Exif information is not shown in TWG but the Windows Explorer does. Why?
- Known restrictions TWG 1.7
Summary Howto
- private.txt - protect your gallery; The filename can and should be changed in the config.php - more than one password is possible - see how-to 12
- private.png - image of a password protected folder when locked - see how-to 12
- folder.txt / folder_<language>.txt - Description of a folder that is shown on the thumbnail and if enabled on the image page - see how-to 7
- image.txt (php) / image_<language>.txt - a powerful way to include text (even dynamic) on the image page - see how-to 28
- foldername.txt / foldername_<language>.txt - The display name of the folder - is used instead the name on the file system. Very helpful for individual sorting of albums! - see how-to 6
- albumr/l.txt / albumr/l<language>.txt - album description like on the first page of the Ajax demo - see how-to 32
- folder.png - the image that is shown instead the first/random/collage image of a folder - see how-to 5
- watermark.txt - The watermark text - see how-to 13
- watermark.png / watermark_big.png - The watermark image for the image view / original - see how-to 13
- link.txt - if you want to link to a web site instead downloading the original image by clicking on the image put the <a > tag in this file. - see how-to 16
- root.txt - You can add a link back to e.g. your homepage. If this file exists you get a home link (or icon) in the left upper corner! You can define the text in the language file: $lang_back_link. If this is not set an icon is shown! + you can create sub galleries with this file - check how-to 21
- url.txt - Link to a remote http directory. fsocksopen has to be available. The url has to start with http:// and end with a / and link directly where the pictures are. - check how-to 20
- back.png - The background image of the folder where it is stored in - check how-to 22
- <directory>.zip - The archive where a whole directory can be downloaded - check how-to 19
- style.css – you can set an individual style sheet for each folder - check how-to 9
- config.php / config_<language>.php - can be used in a folder for individual settings that only should apply for this folder - check how-to 17
- config_sort.php - can be used for individual sorting order for subdirectories - check how-to 6
- header.htm - A header file that is included - the html in there is already in included in a <td></td> - check how-to 3
- footer.htm - A footer file that is included - the html in there is already in included in a <td></td> - check how-to 3
- left.htm - A file that is included on the left - you can put your navigation there - the html in there is already in included in a <td></td> - check how-to 3
- overview.htm/thumb.htm/image.htm - html that is included on the overview/thumb/image page - since 1.7 language dependant too! - see how-to 3
- folderlink.txt - you can link e.g. to another gallery when you click on a overview link by placing this file in a folder - simply put an <a> tag in this file e.g.: <a href="http://www.spiegel.de">
- video.php - very important file if you want to use videos or mp3's - see howto 34 for details!
- menu.htm - (new 1.7) you can extend the menu on the right upper side by something you like. Simply create a file called menu.htm in the main folder and put your menu items there.
Please note: Please use the html representation in the .txt files of special characters: ä -> ä (exception: watermark.txt !).
Since TWG 1.6: Please store all your text files in UTF-8! Then special characters are displayed properly!
That's it ;)
Have fun!
1. How to make TWG secure
If you install TWG like the installation site says it is working on all systems very quickly. I have included some index.htm pages in all directories which prevents that the directory can be listed. If you want to protect your data a little bit you should change some rights on your system. I assume that php is running with full rights. If this is too tight you have to use the settings for the group.
If you get permission denied even with 770 e.g. in the xml folder you have to use 777 for the directories. You can still use .htaccess (if you know what to do with it ;) - I have provided a template in the config-demos directory where you have to change the domain name - please read the readme.txt in this folder):
- Set the counter and xml directory with chmod (check your ftp program) to 700 (770 if too tight, 777 if too tight). Nobody has to read this directories from outside. if you have to use 777 you can place a .htaccess file in his folders. Use the one from the inc folder. It does not allow any access from the web.
- Set the cache directory with chmod to 744 (774 if too tight, 777 if too tight). The cache directory has to be accessible from everywhere but not to be listed! Don't place a .htaccess file there because TWG does link directly to this folder!
- Make sure that e-mail encryption is turned on in the config.php - encrypt_emails=true. This is NOT the default. Please change the encryption key $encrypt_emails_key. If you leave it like it is, anyone who is downloading TWG with this default key can decrypt your emails by debugging TWG!
- Make sure that the external login is disabled in the config.php - $enable_external_privategal_login=false. This is the default. Only turn this on if you need it!
- If you use private galleries or disable the download of the images you should change the permissions of the picture folder. Set the pictures folder and all sub folders to 770. $enable_direct_download has to be set to false because all download have to be done by calling the image.php!
OR you can place a .htaccess file in his folders. Use the one from the inc folder. It does not allow any access from the web. - Change the name of the password file (config.php: $password_file) to .htprivate (".ht" is the important part!) if you are on a unix/linux system with an Apache web server. All files starting with .ht are protected by default. You can use any extension where your web server does not display the files!
- Use encrypted passwords. Set the flag $encrypt_passwords to true. Choose the encryption method SHA1 or SHA256 (more secure but slower) with $use_sha1_for_password. SHA1 is enough but you have to have PHP > 4.3 installed. otherwise the SHA256 from TWG is used. Call the password.php in the main directory to generate your passwords! You have to enter this password either in your 'private.txt' file or as the default password in the config.php at $privatepassword. Use the encrypted password only for $privatepassword - the other ones are not encrypted if you set $encrypt_passwords to true!
- That's it :).
If you have found some more settings to make TWG more save please let me know.
2. How to include TWG into php sites or a cms system (like mambo, phpnuke).
It is now possible to integrate TWG into existing php sites in different ways: You could include TWG by using an extra frame or an iframe. If you want to do this please check the example_i_frame_include.htm. This is the way that works for sure ;).
1. iframe includeI have never wrote anything about the iframe include before but now I have to do this because all browser handle this a little bit different and I want to tell you the problems that can show up:
If you include TWG in an iframe it's normally shown very nice in Firefox (1.x, 2.x, 3 beta 4), Opera (8.x, 9.x) and Safari. You can simply use e.g.
<td width="100%"><iframe name="twg" FRAMEBORDER="0" src="twg/index.php" width="100%" height="100%"></iframe></td>
to include TWG in a table cell of you page. Scrollbars are shown nice and work well.
Check your gallery now. If it's displaying fine in all browsers don't continue to read because it might only confuses you ;). I like to have it perfect. If you like it too continue to read ;).
The problems does occur with IE (6.x and 7). For an optimal integration only scrollbars should be shown if they are really needed. And here IE has a problem. He reserves the space for the scrollbar and this is not very nice. And here is the tradeoff: You can force IE to either
- Reserve the scrollbar area (in the background color of your site) and handle scrolling very nice.
- Don't reserve the scrollbar area but then the scrolling is not really working anymore because the content is not updated and only a blank area is shown.
But there are solutions ;):
If you have setup your gallery that everything (detail page - top x...) fits into the iframe (=iframe is big enough) then you should do the following:
- Add scrolling="no" to your iframe - this is the easiest way and if look optimal in all browsers!
or (the older way which I will remove in the next version because it's confusing - I recommend not to use it anymore)
- Set iframe include to true ($iframe_include in the my_config.php or in the administration). Round corners are not supported for IE in this mode. The normal corners are used!
- Set the height if the iframe ($iframe_height_ie). Default is 99% which is o.k. for ~ a height of 500px. If you have higher iframes you can increase this value to e.g. 99.3%. If a scrollbar is shown in IE the number is too high ;).
If you want that your iframe can scroll properly and everything looks perfect you have to do the following:
- Set iframe include to false ($iframe_include in the my_config.php or in the administration) = default
- The color of the reserved space could be different and can be seen. Set the following styles (in your my_style.css or the <skin>.css):
- body.twg { background-color to the background color of your site - transparent is a color too if you like the background of your site!
- td.twg_info { background-color to the color you like in the inner area - transparent is a color too if you like the background of your site!
- Don't use a background image inside TWG - set allowtransparency="true" in your iframe and use the background of your site because you cannot set the color of the reserved space seperately.
- I always recommend to make it in the background color of your website. Then no one will see it. And turn the border off - gives you alittle bit more space for the images.
- Check the layout in the iframe if ie. As you see you now have a ~ 15px space on the left side which IE reserves for the scrollbar. If you have done the color corrections it should be in the background of your site. If this does not bother you - fine. If it does bother you: Create a file called left.htm in the main folder of TWG and copy the following into it: <?php if ($msie) echo ' '; ?> or make a 15px margin in the left side of the iframe. Then the margin is equal on both sides.
I hope this made everything a little bit clearer and does not confuse you even more (please blame Microsoft for not sticking to the w3c standard).
If you think this howto can be improved - please tell me.
TWG can be included directly in existing php sites or cms systems. If you want to use 'include index.php' (see example_php_include.php) you have to set the following 2 settings:
- $php_include=true;
- $install_dir="<path to the twg installation>/" - The / at the end is important! If you e.g. have twg installed in the directory twg relative to your mina file then use $install_dir="twg/";
All parameters that don't belong to TWG are added again to the url! If your main php file (e.g. gallery.php) has the parameter &id=3 this parameter is added to all links of TWG and all links from TWG use gallery.php instead index.php. If you open the gallery in a new window the standalone modus ia activated again!
If some parameters should not be added to a link in TWG enter these parameters in the config.php: $ignore_parameter
Please note:
- If the gallery does not work properly most of the time the doctype is the problem - please remove the one from the calling page and use
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
If the cmotion gallery on the image page does not work: this is the problem. If you have spaces in the collage in Firefox: this is the problem ;) - Round corners are not supported because IE does not support this properly in this mode. I maybe try to get this to work in one of the next versions! Right now round corners are disabled automatically if $php_include=true;
- If the bottom part seems to be cut of, your surrounding environment has most likely set a table to a fixed height but no height in the cell where the TWG is integrated. Please add the missing height (in pixel not %) to this <td> in your template.
- Check the text in $default_text and $email_bottomtext - there is a %s where the link to the gallery is inserted by default. If you use php include this link is wrong (admin does not know your main page) - you have to insert the right link instead of the %s
- If you use div's please make sure that you have a simple surrounding div with width,height=100% - otherwise TWG cannot position the iframes properly
- You can adjust the position of the iframes from version 1.5.3 with the parameters $iframe_xoffset and $iframe_yoffset in the config.
- If you use a char set: use UTF-8 to have a consistent system. Since TWG 1.6 all language files and used char sets are in UTF-8! If you want to change the charset to TWG please change it in the language files - it's definded at the very top.
- If you use php include no body tags are written by TWG - This means no style from the body (background!) is used! The background from your main site is used then!
I have only done basic tests on cms systems - if you have any problems - please let me know !
1.4.1 has an enhanced keyboard navigation (t opens title, c opens comments ... - see user help). If you include TWG and you have an input filed on the page too you should set $disable_enhanced_keybord_navigation to true.
3. How to integrate your own HTML into TWG
You can add additional HTML to many parts of TWG. If you don't want to include TWG into an existing page but add an additional footer or header you should use the files described below.
| File name | Style | Location | Description |
|---|---|---|---|
| header.htm | twg_headerhtml | TWG folder | Is included as header |
| footer.htm | twg_footerhtml | TWG folder | Is included as footer |
| left.htm | twg_left.htm | TWG folder | Is included on the left side - $left_htm_width defines the width of the column |
| overview.htm | twg_overviewhtml | TWG folder | Is included below the albums on the main page |
| thumb.htm | twg_thumbhtml | TWG folder | Is included below the thumbnails on the thumbnail page. You should set $thumbnail_offset_y to the heigt of the conent you include. Then the autodetection of thumbs works perfect ;). |
| image.htm | twg_imagehtml | TWG folder | Is included below the detail image on the image page |
| topx.htm | twg_overviewhtml | TWG folder | Is included below the thumbnails on the topx page |
| thumb.htm | twg_thumbhtml | subfolders | thumb.htm can be in the main folder AND in each folder. Makes it possible to e.g. show a pdf download link depending on the folder. |
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>
- twg_type - you can set this value to random or top. random shows a random image, top shows the most viewed image of a folder (or the subtree if twg_random_subdir=true)
- twg_album - Change the album to the album where the image should be picked! (has to be url encoded - go inside the gallery and copy it from the url there!). you can add several albums by separating them with an |
- twg_random - Number has to be unique for one page (it is possible to have more than one random image on a page!) - simply start with one and count ... - read the special setting if you set twg_type=top
- twg_random_size - Size of the image max x or max y value! - please keep in mind that vertical or horizontal images could be chosen and therefore your layout of the page where the image is show should be able to show this nicely.
- twg_random_subdir=true - All unprotected albums below twg_album are integrated
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. How to setup a folder image
If you don't have any images in a folder (only other directories) or you don't want that images from this folder are displayed you can set a folder image for each folder. Simply put a png image called folder.png in the directory. Simply rename a jpg to png ;).
Important: The original size of the image is used here! This makes it possible e.g. to use really big images on the 1st page and for subdirectories smaller ones! If you have protected galleries you have to use a private.png
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:
- You want to sort the directories in a way you like and add e.g. 1,2,3 at each directory to get the sorting you like but that does not look good.
- You want to use a image or a different font for a folder
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 file
To add a new language you have to translate one of the existing language file (e. g. language/language_de.php - the name of the needed flag is language/language_de.gif) and copy it in the 'language' directory (+ the flag). If you provide a file language/language_<lang>.txt you can specify the tooltip. Please write the language in English and then in the language of the country in Brackets e.g. Germany (Deutschland). If you need a flag - please send me an e-mail.
Please 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
- Convert hex in decimal colors and the other way around
- Select a color from the color map and click on the preview on the right side to see how it looks
- Create a style sheet from your setup and save it al my_style.css
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:
- style.css (main folder) in the main folder is the default style sheet.
- framestyle.css (main folder) is the style sheet where the right/left/bottom frame colors are defined.
- my_style.css (main folder) is the style sheet where you can put your changes to style.css
- If you select a skin (see howto 25) then this style sheet is loaded now.
- style.css (album folders) is the style sheet which can be different for each folder. You can define a different style for each folder! If you use different backgrounds you should also create a config.php in this folder where you define the backgrounds of this folder - see howto 25.
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. How to check which php version is available on your server and if TWG likes it
There is a file called info.php in the main directory of TWG. If you call this file instead of index.php TWG is checking some requirements and is printing the php info. If TWG is not running properly or not all features are available it is always nice to take a look there. Then check the FAQ - there are some memory issues already covered.
In the TWG Admin is an enhanced info! It tells you even more about which permissions are needed for which file/folder.
11. How to link directly into a password protected gallery
It is possible to link into a gallery or to a image. Simple copy the link in the URL! But this does not work with password protected galleries! To link directly into protected folders you have to copy the URL from the gallery you want to link to. You have to login to get this URL! After that you have to add the parameter &twg_private_login=<gallery password> to the URL. Please note: the password is not encrypted. This feature will be added by the administration which is coming soon (I hope ;)). If you use encrypted password (see how-to 1.7) you have to add the encrypted password!!
The parameter $enable_external_privategal_login has to be set to true to enable this kind of login. The default is false!
12. How to set passwords for a gallery (and how-to set multiple passwords for one gallery and why ;))
To protect a gallery with a password you have to create a empty file with the name 'private.txt' (or whatever you have set you password file in the config) in the directory you want to protect. If the file is empty the password from the config ($privatepassword) is used. If you want to protect a gallery with a different password you have to enter the password in the 'private.txt' file.
This is the description from the config.php. I want to make some more comments at this point because some people asked:
- The name of the password file can be changed in the config.php - check the config.php ($password_file) or ask your gallery administrator if he has changed it (maybe because of security issues - see how-to 1
- Passwords can be encrypted - see how-to 1 for details!
- Important: private.txt files do NOT work recusive (up to 1.7.4)- this means you have to place a private.txt file in all folders you want to protect! This was changed in TWG 1.7.5! Now private.txt DOES work recursive!
You can now use several passwords for each directory. Simply create a normal password file and separate the different passwords with a ','. e.g. test,test2,test3. Make sure that there are no spaces between the commas and the passwords. If $encrypt_passwords=true you have to use the generated password!
By using multiple passwords you can give some friends access to some directories and e.g. your family access to other directories. The advantage is now that these two groups can now have access to the same galleries as well! Or you can protect all galleries with a kind of "super password" and a couple of directories with a 2nd password for access of only an area.
Folder image for protected galleries
You can also set your individual image for a password protected gallery. Create a file named private.png and place it in the protected folder. The size should be the size you have set in the config.php (default is 120 x 120). Since 1.6 an image is autogenerated if $autogenerate_private_png = true; (=default). private.png files always overwrite a autogenerated one!
Important: If you use another size than the one in the config.php the original size is used - This is because you can use individual folder images which have the same behavior.
New 1.7: You can use a private.txt in the main folder! Then a global login window is shown.
New 1.7.5: private.txt does now work recursive and protects all subfolders as well.
13. How to configure watermarks and text on an image
The description at the watermark section is a little bit short in the config.php file. Therefore I will give some additional explanations:
- Read the watermark section of the config.php!
- Text on images and watermarks can be set independent of each other - you can use none, one or both.
- Make sure that you have set $enable_direct_download=false if you want some watermarks on the originals!
- If you use a random image: The watermark is only printed if the size is < 200 px and the watermark fits on the image!
- The text is always on the left bottom corner - the watermark image can have 9 positions!
- Your watermark image should have a solid outline and the background color should surround this for best results. See the buttons/watermark.png I use for the demo.
You can use individual watermarks for each folder! You can do this by creating the following files:
- watermark.txt - The watermark text
- watermark.png - The watermark image for the image view
- watermark_big.png - The watermark image for the originals
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.
- Check if you done all the installation steps (rights and so on...).
- Check the FAQ below!
- Check the debug file - The location is defined in the config.php and is counter/_mydebug.out by default. Many problems are reported there.
- Delete the content of the cache, xml and counter directory
- Call the file info.php in the TWG main directory or in the administration - on the top are some internal twg tests. Maybe this helps already :). Below is the php_info call where your php info are show. Interesting are the installed modules like gd (with freetype), and memory limits (see 1st faq). If you get errors in the _mydebug.out: most of the time the php configuration/version makes the problem!
- Check the forum
- If you have problems with the flash! Read the FAQ for the flash in the TWG Flash Uploader section - There almost all problems are covered!
- Contact me. Via forum is preferred because if I answer your problem, there is maybe someone else get help there too. But still feel free to contact me directly!
15. How to change or extend the smilies
TWG 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 file
If 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 notification
By 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 directory
You 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 directory
This a really nice feature. You can link to images which are located on a remote web server. You have to have two things:
- The images are located on a remote http server where the directory can be listed
- fsocksopen() has to be enabled on your php installation (www.funpic.de does not - therefore I cannot show this in the demo).
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 is 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 right now:
http://mdempfle.md.funpic.de/pictures/2006_06_boas/
simply put it in an url.txt - You an try the url firs 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 :).
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!
21. How to add a "home" link to the gallery and how to create independant sub galleries
NEW 1.7.0.6 - I have rewritten the implementation of root.txt to make it easier to handle! If you have this version ignore the stuff below.
A root.txt can be used for 2 things:
- Adding a "Home" link to a gallery - If you like to make a link back to e.g your homepage. This adds a new link on the left upper corner on the main page. Please add $lang_back_link to your language file. I only have added this to German and English. For all other languages a "home" icon is shown! Please add e.g. $lang_back_link = "Home |"; to your language file if you like! The root.txt has to contain a link like http:// ....
The root.txt can be in 3 places:- main folder of TWG: The "Home | " link is added too ALL breadcrumbs!
- pictures folder of TWG: The "Home | " link is only added to the album overview page
- sub directory: The "Home | " link is added to the directory where the root.txt is + to all sub directories. This file can be empty too - please read the next part because here the file does a little bit more!
- Create sub galleries that look like independant galleries - a root.txt defines your new root if you use this file in a sub directory. No path to upper directories are shown then. This file works now recursive. You don't have to define this in sub directories of you new root. If you lease the root.txt empty it simly looks like the root. If you add an URL in this file starting with http:// then the "Home" link is shown too!
Before 1.7.0.6 - I will remove this part soon!
Since 1.5 it is possible to create a root.txt directly in the pictures folder! This adds a new link on the left upper corner on the main page. Please add $lang_back_link to your language file. I only have added this to German and English. For all other languages a "home" icon is shown! Please add e.g. $lang_back_link = "Home |"; to your language file if you like! The root.txt has to contain a link like http:// ....
Since 1.7 you can put a root.txt in the main folder of TWG as well. Then the link is shown for all folders!
This does work for all subdirectories too if you want to have this link there as well! In sub directories this file behaves differently! If you specify a root.txt with an url in the 1.st level sub folder this means that this is the root! This makes it possible that you have e.g. 2 sub galleries that look like independent galleries! To use this feature you have to define a root.txt in every sub folder! If you specify a real link like http:// in this file you get the "Home" icon/text in the left upper corner! If you don't want a home link but a real sub gallery then the root.txt files have to contain the name of the directory that should be the new root. e.g. if your path is pictures/test/sub1/sub2 and you want that sub1/sub2 look like a separate gallery than the root.txt has to contain sub1.
There is one exception from this behavior: If you have a root.txt in the pictures dir and in the 1st sublevel then the 1st sublevel is NOT treated as root but the "Home" link is shown (if a http... is in the root.txt)
22. How to use a different background image for each folder
You 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!
- Backup my_config.php, my_style.css, the counter, xml and your pictures folder to the new installation. admin/.config/.htuser.php can be copied too but you should check your users afterward because TWG 1.6 has some new user rights that are set to default for old users.
- Install TWG 1.6
- Copy the saved files my_config.php, my_style.css, counter and pictures back to their old place. admin/.config/.htusers.php goes to admin/_config/.htusers.php. Open the files my_config.php and .htuser.php with a textedit and save them as UTF-8 files! (save as .. and then most editors give the option to store as utf-8. Or use the TWGXplorer - it stores files in utf-8 too.)
- The xml files have still the same format but special characters like äöü from xml's of version 1.5 are not encoded properly anymore. You have 3 choices:
- If you don't have many comments and/or captions recommend not to use these files and let TWG generate new ones!
- Only special characters are not displayed properly - If you don't have e.g. German chars like öäü. No problem
- If you want to keep the comments/captions you can change TWG back to the mode used in TWG 1.5! Open the language files your are using in the language folder and remove the $charset="utf-8"; at the top of each language file + change the encoding in the language files of admin/_lang to $GLOBALS["charset"] = "iso-8859-1";
Then TWG works like it did in 1.5 - If you do this - please do not edit any files like folder.txt in the TWGXplorer because they are stored in UTF-8 (or use e.g. ü instead of ü).
- TWG 1.6 is now using UTF-8 everywhere. (if you have not changed it in 4-3)
Please store all your text files (like folder.txt, foldername.txt) in UTF-8! Then special characters are displayed properly! - Make sure to set the permissions of the files of the counter and xml folders that php can write them again - on most servers 777 is needed!
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/.htuser.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.
- Sichert my_config.php, my_style.css, admin/.config/.htusers.php das counter,xml und euer Bilderverzeichnis. Wenn ihr Änderungen in der config.php habt: Bitte in die my_config.php übernehmen bzw. im TWG Admin eintragen!
- Installiert TWG 1.6.
- Nun könnt ihr my_config.php, my_style.css, counter und pictures einfach wieder einspielen. admin/.config/.htusers.php kommt nach admin/_config/.htusers.php. Öffnet die beiden Dateien my_config.php und .htuser.php mit einem Textedit und speichert diese als UTF-8! (Speichern unter ... und dann bieten die meisten Editoren an, die Datei auch in UTF-8 zu speichern. Oder verwendet den TWGXploer - der speichert auch alle Dateien in UTF-8)
- Das xml Verzeichnis ist etwas komplizierter, da TWG jetzt überall utf-8 verwendet aber z.B. die Kommentare nicht mehr korrekt angezeigt werden, weil die nicht so gespeichert wurden.
Ihr habt nun 3 Möglichkeiten:- Schmeist eure alten Kommentare weg.
- Lebt damit, das Umlaute etwas unschön dargestellt werden.
- Stellt TWG wieder von UTF-8 auf den Stand von 1.5 zurück. Dafür müst ihr einfach aus den Sprachdateien (Verzeichnis language/), die ihr verwendet die Zeile
$charset="utf-8"; entfernen + ändert das Encoding in den Sprachdateien in admin/_lang in $GLOBALS["charset"] = "iso-8859-1";
Bitte verwendet jedoch nicht mehr den internen Editor vom TWG Admin, da dieser alles in utf-8 speichert.
- Speichert Dateien wie folder.txt, foldername.txt in utf-8 - Die meisten Editoren bieten dies bei "Speichern unter " an.
- Setzt die Rechte in den Verzeichnissen counter und xml. Es müssen auch die Rechte der Dateien selbst so gesetzt werden, dass php diese wieder schreiben kann. 777 für alle Dateien reicht hier meistens ;).
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:
- a style sheet called <skin name>.css - This is like the my_style.css in the main folder - you can enter all styles TWG known in there! You can use the color manager to create one.
- a php file called <skin name>.php - Here are the config.php settings for this skin. Normally you place here if you use dynamic background and the colors of the background of the slide show. You can also disable e.g. the optimized slide show because it does no look that good if you have a background image. Check the elements of he skin section - it makes sense to adopt them for a skin
- a background image called <skin name>.jpg - This image has to be entered as the background image in the <skin name>.php. I recommend to use a resolution not larger then 1024x768 and set he dynamic background to true - otherwise the loading time for the background is maybe too long for some users. Like with the back.png the background image is not shown if a slow connection is detected - Therefore always define a background color too.
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:
- Provide a jpg file that should be used as preview image for your avi file.
- Rename the two files that way that they have the same file name but with the extension jpg and avi. e.g. mymovie.jpg and mymovie.avi - don't use special characters here because TWG provides a direct download to this file and not all web servers work properly with special characters.
- Check the config.php if your extension is already supported: There is an array $other_file_formats where the file extension and an image is defined.
- The image that is defined is rendered a watermark on your preview image! You can add file formats or change the watermark in the buttons folder! You can select the position and the transparency of the watermark.
- Copy the two files to your web server ;).
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 properly
Internet 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.txt
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.
- Simple text include: The image.txt can be included in 3 positions:
$image_txt_position does define it - Possible values are: "top","bottom" and "side". top and bottom are obvious. "side" does include an image.txt and an image2.txt. The image.txt is included on the left side - image2.txt is included on the right side! Be careful about the code you want to show. image.txt and image2.txt should "need" the same amount of space to keep the image centered! Furthermore I recommend to use a div with a fixed width because IE does sometimes bad rendering and moves the image to the left! The "exif" example on the Ajax demo shows this simple include with position = top.
- Include as php file: You can change the $image_file_extension in the config to php. Than you can include everything you like in this file - tables or even php code! You can get the image name by using the variable $image! This makes it possible e.g. to include a different file for each image or create a dynamic link to a shopping cart! The "USA 2005" folder from the Ajax demo shows how this is used. Only the english part uses this ways - the german description uses method 3. I only mixed this in the example - normally you only use method 2 or 3 ;).
IMPORTANT: If you use image.php like in the examples folder you have to protect this file by the following line:
defined( '_VALID_TWG' ) or die( 'Direct Access to this location is not allowed.' );
- Since 1.6 it is possible to use the image.txt like a properties file. This means you can have one line of text for each image in this file.
e.g.
image1.jpg=This is the description for image 1
image2.jpg=This is the description for image 2
To enable this mode you have to set $image_file_is_multi = true;
The German (!) example "USA 2005" folder from the Ajax demo shows how this is used (config_de.php + image_de.php + image2_de.php - the php extension is only used because I mix mode 2 and 3 in the example - normally you can use txt files here!).
PLEASE NOTE: If you only want to display a caption simply use the build in caption feature - login at the right upper corner - then you get a menu item call "Caption" and then you can enter a caption for each image! image.txt is intended to display additionally data like I did in the example!
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 navigation
If 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!
- User management: You can create users and give them certain rights! If you want someone to be able to upload you should give him at least modify rights! Important is the main directory of the user. You should only use . for administrators because this makes it possible even to modify TWG itself! Normally it is enough to use the pictures directory or a subdirectory of it for the user.
- Safe-Mode: "When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory.".
This is the very short description from the php manual but I want to explain this in a little bit more detail ;):
If a php script is executed it is either done by the owner of the script (the ftp user) or the php user like "www-run" or "apache". If the script is executed by the owner the safe-mode is no problem - but most web hosters don't even know how to configure their system this way. Therefore php is normally run by a user like "www-run" or "apache". And if this is the case you have the "www-run" problem. This means that if you want to edit your files or upload files to a directory with the TWGXplorer the permissions have to be set to 777 because the owner of the file is not the same as the one who runs the script! And that means that everyone (who can run a script on this server) can access this files.
And now the safe-mode restrictions apply! Lets assume you upload TWG to a directory on your web server. Then you change the permissions that the TWGXplorer can create a directory below the pictures folder (pictures folder has to be set to 777). This is possible because the main directory belongs to the owner of the script. But if you now try to create a file in this directory this would lead to an error because the directory belongs to the owner "www-run" or "apache" while the script does belong to your ftp user!
TWG tries to detect many of this situations and this is why you cannot create or upload everywhere. But what is the solution?- If you don't have the "www-run" problem - everything is fine - you can check the user by moving the mouse over the ? next to the owner in the header line - if the user is the same for the ftp and files created by twg admin you are fine - don't care about the safe-mode. Most likely your php is running with phpsuexec (check the last entry of the TWG Admin on the info page - it tries to detect if php is running this way)
- If safe-mode is off and you have the "www-run" problem you can set the permissions to 777 and work with your files almost without restrictions. But you should protect your files with a .htaccess file (there is an example in the configs_demo) if you want to have private albums.
- If safe-mode is on and you have the "www-run" problem you can:
- Ask your ISP if he turns off safe-mode (mine did!)
- Ask your ISP if he can configure php that way that the www-run problem does not happen - I googled a little bit an this can be done by running php not as module but by including it with cgi (running phpsuexec! - more and more provider do this!)
- Some ISP have the possibility in the web interface that you can change the owner of your files to the php owner - but be care full - If you do this you maybe cannot manage your files with your FTP program anymore.
- Ask your ISP if he changes the owner for you! (FTP problem like described at 3 can happen!)
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 installer
If 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/.htuser.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
- Upload the 3 files from the download that start with 'install'
- Check if the twg folder has 777 as permissions - if not please change that!
- Start install.php - - READ if anything is red!
- Click update an you are done - the installer will keep your pictures folder and the my_config.php and my_style.css. It make a backup if the config.php too. You can delete this after the update! I only make this of security issues because I think there will be some people around who forget to store everything in my_config.php ;).
- Save files like folder.txt, foldername.txt .. in utf-8 if you have special characters like öäü!
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 only
TWG has integrated the lighbox script and lytebox script (since 1.7.4) for registered users. This feature can be activated at 3 points:
- On the thumbnail page
- $activate_lightbox_thumb=true; - activates this feature on the thumbnail page.
- $activate_lightbox_thumb_full=false; - if true the whole thumbnail activates the lighbox script. It's then not possible to get on the image page anymore. If false, there is a small zoom icon in the left upper corner of each thumbnail. If you click on this the lighbox image is shown.
- $use_original_on_thumbspage=false; - Normally the detail image is used on the thumb page for the lightbox - but you can use the original too if you like! Just set the parameter to true! Settings this to true makes everything a little bit slower but the images displayed optimized to the browser resolution
- On the TopX page
- $activate_lightbox_topx=true; - activates this feature on the TopX page.
- $activate_lightbox_topx_full=false; - if true the whole thumbnail activates the lighbox script. It's then not possible to get on the detail page anymore. If false, there is a small zoom icon in the left upper corner of each thumbnail. If you click on this the lighbox image is shown.
- $use_original_on_topxpage=false; - like $use_original_on_thumbspage only for the topX page
- On the image page
- $activate_lightbox_image=true; - if true clicking on the detail images does not open the image in a new window or a popup but in the lightbox. Download has to be activated to use this feature + you cannot download the lighbox image with "right click -> save image".
On the image page you cannot go to the next image in the lightbox. But actually there is a better way to do this. If you go to "Option -> Maximized view" you can enable the fullscreen mode of TWG. You can automatically use this instead of the lightbox with the following settings:
$activate_lightbox_image=false;
$open_as_popup=false;
$open_in_maximized_view=true;
- $activate_lightbox_image=true; - if true clicking on the detail images does not open the image in a new window or a popup but in the lightbox. Download has to be activated to use this feature + you cannot download the lighbox image with "right click -> save image".
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 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)
- Embed a streamed video with a flash player that comes from a remote site like youtube.com or video.google.com
- Embed a streamed video with the Divx Web Player
- Embed a video with the Windows Media Player
- Integrate wmp streams like webradio and video streams. (new 1.6)
- Embed a flash video with the local flv player (new 1.6)
- Embed a quicktime video with the Quicktime player (new 1.6)
- Embed streamed mp3's with the flash player that comes with TWG
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. You have to have a preview image for each video in the folder. The name of the thumbnail file is different depending which type your are using (See below).
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:
- Not using a video.php at all! You have to set $video_autodetect = true; (=default). Then $video_php_x_default and $video_php_y_default are used as width and height!
- Using a video.php where $video_player="AUTO"; <?php
$video_size_x=320;
$video_size_y=310;
$video_player="AUTO";
$video_autostart=true; // or false - depending what you want
$video_show_dl_link=false; // true or false works
$show_slideshow = false;
$default_big_navigation="HTML"; // should be set if you have images and videos in one folder!
?>
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.
- video.google.com
Maybe video.google.com is the best know provider. If you upload your video (or just want to embed one of the existing) you have an url like
http://video.google.com/videoplay?docid=3892003977065756728
The interesting part is the value of the docid. To include this video into TWG you have to use the value of the docid for the thumbnail e.g. 3892003977065756728.jpg.
The video.php should look like this:
<?php
$video_size_x=320; // google says 400x326 but most videos fit in the values I set!
$video_size_y=267;
$video_player="GOOGLE";
$video_flash_site = "http://video.google.com/googleplayer.swf?docId=";
$video_autostart=true; // or false - depending what you want
$video_show_dl_link=false;
?>
You can of course use video.google.de as well. Google does support autoplay!
- www.youtube.com
This is my personal favorite of the embeded flash players because the site is quite quick, has a lot of videos and it it possible to make your uploaded videos private. Means they can not be found on youtube by search! If you upload your video (or just want to embed one of the existing) you have an url like
http://www.youtube.com/watch?v=qMSrpZi_6WM&search=josh%20blue
The interesting part is the value of the v. To include this video into TWG you have to use the value of v for the thumbnail e.g. qMSrpZi_6WM.jpg.
The video.php should look like this:
<?php
$video_size_x=425;
$video_size_y=350;
$video_player="FLASH";
$video_autostart=true; // or false - depending what you want
$video_show_dl_link=false;
$video_flash_site="http://www.youtube.com/v/";
$video_autostart_parameter="&autoplay=1";
?>
youtube does support autoplay!
- www.myvideo.de
This a very good german site with los of german clips and is quite fast too. myvideo.de does NOT support autoplay - therefore you have to click on the play button of he flash after you select the video!
If you upload your video (or just want to embed one of the existing) you have an url like
http://www.myvideo.de/watch/10235
The interesting part is the value after the watch/. To include this video into TWG you have to use the value after the watch/ for the thumbnail e.g. 10235.jpg.
The video.php should look like this:
<?php
$video_size_x=470;
$video_size_y=406;
$video_player="FLASH";
$video_autostart=false; // true does not work for myvideo.de!
$video_flash_site="http://www.myvideo.de/movie/";
$video_autostart_parameter="";
?>
myvideo does not support autoplay!
- www.dailymotion.com
I don't have big experience with this site. It has many french clips and work fine with TWG ;). dailymotion.com does NOT support autoplay - therefore you have to click on the play button of he flash after you select the video!
If you upload your video (or just want to embed one of the existing) you have an url like
http://www.dailymotion.com/swf/sD4zsqKE0tdFuXZ9
The interesting part is the value after the swf/. To include this video into TWG you have to use the value after the swf/ for the thumbnail e.g. sD4zsqKE0tdFuXZ9.jpg.
The video.php should look like this:
<?php
$video_size_x=400;
$video_size_y=316;
$video_player="FLASH";
$video_autostart=false; // true does not work
$video_flash_site="http://www.dailymotion.com/swf/";
$video_autostart_parameter="";
?>
dailymotion does not support autoplay!
- www.metacafe.com
This is a little bit different than other sites because they have a folder structure to navigate to the pictures. e.g. a video link looks like this:
http://www.metacafe.com/watch/504296/belly_dancers_man_vs_woman/
The interesting part is the value after the watch/. To include this video into TWG you have to use the value after the watch/ for the thumbnail AND replace the first / with ___ (since 1.7.5 _S_) and remove the 2nd / e.g. 504296___belly_dancers_man_vs_woman.jpg (since 1.7.5 504296_S_belly_dancers_man_vs_woman.jpg)
The video.php should look like this:
<?php
$video_size_x=464;
$video_size_y=380;
$video_player="FLASH";
$video_flash_site ="http://www.metacafe.com/fplayer/";
$video_autostart_parameter=".swf";
$video_autostart=true; // important - autostart has to be added the .swf?... if possible
$video_show_dl_link=false;
$show_rotation_buttons=false;
?>
metacafe does not support autoplay! The video_autostart has to be true because the auto start parameter ".swf" has to be added to the generated url.
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
- Embed your own swf's
It is also possible that you can simply embed your own swf's! If you want to do this you have to have the swf's in the directory where they should be displayed. As example you have a flash called test.swf. Then you have to provide a thumbnail called test.swf.jpg!
Then you have to put a video.php like this into this directory:
<?php
$video_size_x=425;
$video_size_y=350;
$video_player="FLASH";
$video_flash_site="http://localhost/TinyWebGallery/pictures/Multimedia/009_swf/";
$video_autostart_parameter="";
$video_show_dl_link=true; // true or false works!
?>
The important setting is the $video_flash_site - This is the directory where the flash is located. If you make this static you have to change the url if you copy the folder e.g. from your local server to your destination in the web! In the example above this is my local setting!
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):
$video_size_x=425;
$video_size_y=350;
$video_player="DIVX";
$video_autostart=true; // true or false works!
$video_show_dl_link=true; // true or false works
?>
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):
$video_size_x=320;
$video_size_y=300;
$video_player="WMP";
$video_autostart=true; // true or false works!
$video_show_dl_link=true; // true or false works
?>
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:
- remove the http://
- replace / with ___ (Since 1.7.5 _S_ because ___ is used as sorting prefix as well and now they can be used both)
- replace ? with _Q_
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):
$video_size_x=320;
$video_size_y=300;
$video_player="WMP";
$video_flash_site="http://";
$video_show_dl_link=false;
?>
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
- 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):
$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
?>
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:
$video_player="MP3";
$video_autostart=true; // true or false works!
$video_show_dl_link=true; // true or false works
$video_flash_site=""; // if you store your mp3's local - if you put an url base here you can even link remote
?>
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).
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 files
Since 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.
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:
- Make a backup of the xml folder
- Set $store_xml_in_picfolders=true AND turn off the session cache! (the icon "No cache" is shown then).
- Simply close the browser and open it again - after 5 sec the pre caching in the background is started and moves the counter, captions and comment files.
Only 50 dirs are done in one row (because pre caching is limited to 50 dirs at once). If you have more directories - simply redo this step. - Log into TWG Admin - Extract IPTC Data - Then the xml's for the tags are moved.
- Done ;).
36. How to uninstall TWG if you cannot simply delete it
Because 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:
- Extract the file uninstall.php from the file uninstall.zip in the uninstall directory and copy it to the main directory of TWG. If you have used the installer and safe mode was active twg was installed in the directory twg - if this is the case please copy the uninstall.php to the directory where the folder twg is in (=the directory one above where the config.php is).
- Call uninstall.php - the uninstaller create a file called uninstall.sm.php (The file uninstall.sm.php is now owned by the php user and can delete files and folders even when safe mode is on!)
- Call uninstall.sm.php (Deletes everything where the safe mode restrictions apply)
- Call uninstall.php (Delete the remaining files if still some left ;)).
- The directory should now be empty except any directories you have created by yourself!
37. How to use the new backend rights
You 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:
- Frontend Edit = Login at the front end to enter captions, tags, delete comments and rotate images permanently.
- Frontend Upload = Login at the front end to upload files below the home directory with the Flash Uploader.
- Backend Modify = Upload and modify files with the TWGXplorer in the TWG Admin below the home directory.
- Administrator = Full access to all areas of TWG Admin
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 ;).
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 TWG
TWG 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:
- PixVue (free) - It's an explorer extension - it's actually not longer supported but you will find it somewhere for sure ;)
- MS Photo Info (free) - It's an explorer extension too - The good thing is that you can edit several images at once.
- XNView (free) - You can add/edit the metadata - but you have to open each image first and then select metadata in the menu.
- Almost every image software (Photoshop, Paint Phop Pro ...) - but they are not free ;).
. TWG uses this information at several places:
- Tags
- Caption
- Info screen
To avoid reading this info every time a picture is displayed (which would be quite slow) this reading is done when:
- You enter tags - for image tags the keywords are used (see $iptc_fields_for_imagetags) and for the directory tags the sub-categories (see $iptc_fields_for_dirtags) - This data is automatically entered when you open the enter tags panel.
- You start the IPTC extraction in the TWG Admin - The tags and captions (see $iptc_fields_for_caption) for ALL images that don't have any info in the xml file are extracted and stored in the xml files. This means that the generation only works for images that are new. If you use dir tags please note that only the directory tag from the first file of a directory that has a dir tag is extracted. All other existing dir tags are ignored. Therefore you should actually add dir tags only to one image in your external tool!
- You upload images with the TWG Flash Uploader (see $add_iptc_at_upload)
- You show the info panel - There are all defined and available IPTC data is shown. The data that is read can be defined in the language file $lang_iptc_info - This makes it possible that you define your own metadata and display what you want ;). You can read more than one field in the $lang_iptc_info. Simply define another field - see e.g. Author
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 folder
Since 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!