How-to's for TWG >= 1.2 (only available in English)

  1. How to make TWG secure
  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 way then how-to 2)
  4. How to setup a random image on a different site/frame
  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"
  8. How to create a language file.
  9. How to change colors of TWG
  10. How to check which php is available on your server and if TWG likes it
  11. How to link directly into a password protected gallery
  12. How to set passwords for a gallery (and how-to set multiple passwords for one gallery any why ;))
  13. How to set watermarks and text on an image.
  14. How to track errors if TWG does not work on your system.
  15. How to change or extend the smilies
  16. Linking to a website instead of downloading a file
  17. How to get an overview what I can place in a directory to configure it! (= summary of some how-tows!)
  18. How to enable email notification
  19. How to enable download of a whole directory (new v1.3)
  20. How to link to pictures in a remote http directory (new v1.3)
  21. How to modify the root link of the gallery to link e.g. back to your page instead to the gallery overview (new 1.3)
  22. How to use a different background image for each folder (new 1.3)
  23. How to upgrade from older versions from TWG
  24. How to show more images in the DHTML thumbnail strip
  25. How to use and make a skin! (new 1.3c)
  26. How to include different file formats like avi, mpg ... (new 1.4)
  27. How to configure the hover effects for ie properly (new 1.4)
  28. How to use the image.txt (new 1.4)
  29. How to configure the HTML_SIDE big navigation (new 1.4)
  30. How to use the TWGXplorer and what is the safemode any why is this a problem ;) (new 1.4)
  31. How to update TWG with the installer (new 1.4.1)
  32. How to add big folder descripions like in demo 2 (new 1.4.2) - registered version only
  33. How to use the lightbox feature (new 1.4.2) - registered version only

Please read the FAQ below the how-to's and check the forum as well if you have any problems!

The FAQ covers the problems some users had with the TinyWebGallery >= v1.1. I hope this will help others to get the TWG running.
Please check there first if you have done everything that is needed to run TWG. Please check the forum as well!

Questions:

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 directores 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):

  1. Set the counter and xml directory with chmod (check your ftp program) to 700 (770 if too tight). Nobody has to read this directorys from outside.
  2. Set the cache directory with chmod to 744 (774 if too tight). The cache directory has to be accessable from everywhere but not to be listed!
  3. Make sure that email encryption is turned on in the config.php - encrypt_emails=true. This is 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!
  4. 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!
  5. 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 subfolders to 770. $enable_direct_download has to be set to false because all download have to be done by calling the image.php!
  6. 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 webserver does not display the files!
  7. 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 ist 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 $privatepasswort. Use the enycypted password only for $privatepassword - the other ones are not encrypted if you set $encrypt_passwords to true!
  8. Thats 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: Before 1.2 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 ;). If you use this way of including TWG: $php_include=false, $install_dir=""

TWG 1.2 can now be included directly in existing php sites or cms systems. If you want to use 'include index.php' (see example_php_include.php) your main file had to be in the same directory as TWG in older versions. But this is not really nice because all your code is then located in one directory. A nicer way is to put TWG into a subdirectory like "TinyWebGallery". Then you have to use 'include TinyWebGallery/index.php'. If this is the case you have to modify the $install_dir parameter in the config.php. In the example you have to use $php_include=true (this is used to use a different calculation for the existing resolution!) and $install_dir="TinyWebGallery/"; . The / is important!
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:

I have only done very basic tests on cms systems - if you have any problems - please let me know !

Since 1.4 there is a new parameter in the config called iframe_include. If you set this to true you don't get the scrollbar space in IE anymore because a different doctype is used! But you have some other restrictions: Hovering does not work 100% (read how-to 27) and the tips are not shown completly at the bottom.

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

If you don't want to include TWG into an existing page but add an additional footer or header to the gallery simply create a file called header.htm and/or footer.htm and store them into the main directory (where the index.php is located). The header/footer is included in a <tr><td> </td></tr> of the main table. They also have styles assigned: twg_headerhtml, twg_footerhtml

You can also create a file named overview.htm/thumb.htm and/or image.htm. The code you place in there is added on the overview/thumb/image page below the main content. You can e.g. add a random image there ;). These files are included in a <tr><td> </td></tr> of the main table. They also have styles assigned: twg_overviewhtml, wg_thumbhtml, twg_imagehtml

4. How to setup a random image on a different site/frame

You can setup a random image on an other website which links to your gallery. The following two lines show the image and the link tag:

The image:
<img src="image.php?twg_album=xxx&twg_random=1&twg_type=random&twg_random_size=200">

The link with image:
<a href ='index.php?twg_random=1'>
<img src="image.php?twg_album=xxx|zzz&twg_random=1&twg_type=random&twg_random_size=200">
</a>

You have to add the path to the image.php and index.php to the example e.g. http://www.mygallery.com/tinywebgallery/index.php

In v1.2 you can use only one album. Additionally you have to add the parameter twg_album to the href.

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. Only png is supported here because .jpg would be treated as a normal image!
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:

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: ä -> &auml; The description has to be in one line!!

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 (like shown in Demo -> Palenque on the website) 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 folderdescription 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!

The description can be language dependent as well! By adding the language to the filename you can provide extra translations. e.g. for German: folder.txt -> folder_de.txt.

The same thing can be done only for the image. if you want to have a different text on the image page than on the thumbnail page you have to set $enable_dir_description_on_image to false and put your text in the image.txt. image_<language>.txt is the language dependant version. This text cannot be set individual for one picture - only for the whole folder!

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: ä -> &auml;
I only read the FIRST line of this file - up to 500 characters! - if you want to have e.g. 2 lines: put the code in one line and us a <br /> to generate the new line!

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 email.
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.

If you have a non ISO 8859-1 encoding you can specify the charset in the language file! - e.g. $charset = "UTF-8";
If you want to have a 100% consistent system you have to convert all language files to UTF-8!

Please note:
Please use the html representation in the language files for special characters: ä -> &auml; I use a nice macro "HTML Encoder" for Textpad. Just google for it if you want to save yourself some time ;).

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!

Since 1.3 there is a file called my_style.css in the main TWG folder. I have copied the most important settings to modify the colors of the background, borders, text and links. By default everything is disabled and the settings from the style.css are used. Uncomment the settings you want to change. 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. All changes in my_style do override the settings in style.css. Remove this file if you don't use it because otherwise its transfered 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 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!

Since 1.3 it is possible to have an additional style sheet for each gallery. e.g. if you want to have different border colors for each gallery. This can be included in 2 ways:

  1. Simply place a css called style.css in the folder where the style should be different. That's it.
  2. Solution 1 needs a direct link to the style sheet. If this folder is protected 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 <urlencoded foldername>_style.css. If you are using recursive folders the folders have to be separated with an _. The easies way to name the file is to go into the cache folder and look for the folder name at an image (It is urlencoded!: 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.

In the Domai folder of the example gallery is a style.css that changes the colors of the border and the text. You can use this as template for your own settings! The settings of the style sheet in a folder overwrite the settings of the default style.css and the my_style.css! There are some example style sheets I use in the demo in the config_demo folder! I like the transparent ;)
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!

Remember:

NEW 1.4 !
The color manager in the administration should help you to configure the layout. You can

You can select transparent as color for the background of your areas. I have provided a couple of example background images that become visible if you click on transparent and then on one of the background areas of the preview. You have to provide your own backgound 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!

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 mein directory of TWG. If you call this file instead of index.php TWG is checking some requirements and in 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 administration area (since 1.4) there is an enhanced info as well!

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 any why ;))

To protect a gallery with a password you have to create a empty file with the name 'private.txt' in the directory you want to protect. If the file is empty the password from the config ($privatepasswort) 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:

You can now use several passwords for each directory. Simply create a normal password file and seperate 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.

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 90).
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.

13. How to set 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:

You can use individual watermarks for each folder! You can do this by creating the following files:

PLEASE NOTE: There is a flag called $resize_only_if_too_big - If you have images smaller than the small_pic_size and this flag to true no small images are created and the originals are used instead! As a consequence no watermarks are printed on these images. You have either to add the watermark by yourself or set this flag to false. Butthen you images are enlarged to the smal 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!

14. How to track errors if TWG does not work on your system.

  1. Check if you done all the installation steps (rights and so on...).
  2. Check the FAQ below!
  3. Check the debug file - The location is defined in the config.php and xml/_mydebug.out by default. Many problems are reported there.
  4. Delete the content of the cache, xml and counter directory
  5. 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!
  6. Check the forum
  7. 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 website 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 a special id. e.g.

<a href="<your url>" id='adefaultslide'>

The link is valid for all images of this direcory! - please don't forget the id - javascript will fail if this is missing!

17. How to get an overview what I can place in a directory to configure it! (= summary of some how-tows!)

Maybe you have found out that you can place a lot of files inside a directory that are not jpg's to change something I have set as a default. Here is a short summary what you can do (a better description is always in the real how-tos!):

Please note: Please use the html representation in the .txt files of special characters: ä -> &auml; (exception: watermark.txt !)

That's it ;)

Have fun!

18. How to enable Email notification

By default email 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 email set the $show_email_notification and $enable_email_sending to true. If you go to the overview page you can now register and unregister on the right upper menu. If you login the menu 'register' switches the 'send emails'.
Now set the config.php to the following settings:
$encrypt_emails = false ; // for testing!
$youremail="<your email>"; - This is the from email 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 website and check if you get the registration email - Then login and send a notification message!
go to the xml/subscriber.xml - your email 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 xml folder and the subscriber.xml cannot be read from the web (chmod 700 or 770). You find more information about the parameters on the installation page or in the config.php.

Since 1.3 there are some additional options in the email section. You can be notified if someone enters a comment or vote for an image. Enter the email 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 (new v1.3)

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 webspace (like on funpic where the filelimit 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 (new v1.3)

This a really nice feature. You can link to images which are located on a remote web server. You have to have two

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 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!)

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 fullscreen mode!

You can now link different images galleries together into a single one :).

21. How to modify the root link of the gallery to link e.g. back to your page instead to the gallery overview (new 1.3)

Maybe you want to link back to your homepage instead to an overview of galleries. If you want to do this put a file called root.txt into the folders where the "root" link should be modified. By default the text for the link is "Galleries" (depending on the language). You can modify this by changing the $lang_galleries in the language files you are using!

If you want to keep the gallery like it is but ony want to have an additional link back home there: Do the modifications I explained before. Create a folder "Galleries" in the pictures folder and put all your pictures below this folder. and put the root.txt in the folder "Galleries". If you want to have this language dependant: Create foldername_<lang>.txt files (see how-to 6).

Since 1.4.1 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 = "Zurück zur Homepage |"; to your language file if you like!

22. How to use a different background image for each folder (new 1.3)

You can use an individual background image for each subfolder. There are 2 ways to do this:

  1. Simply place a png called back.png in the folder where the background should be different. That's it.
  2. Solution 1 does not create a direct link to the background image (it calls a php script that returns the image). Therefore its not very efficient and some browsers have problems caching the background image properly. Therefore it is also possible to place the background image into the cache folder. Create a background named <urlencoded foldername>_back.png. If you are using recursive folders the folders have to be separated with an _. The easies way to name the file is to go into the cache folder and look for the folder name at an image (It is urlencoded!: e.g. Usa (+ü$§!%&-;) -> Usa+%28%2B%FC%24%A7%21%25%26-%3B%29) . Copy the folder name part and add the _back to he file name of the png background image.

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 of 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.

23. How to upgrade from older versions from TWG

If you want to upgrade from TWG 1.1.2 or 1.2 to 1.3 you can still use your counters, captions and comments.

Please don't install a version 1.3 over a version 1.1.2 because the whole directory structure ist different here.
When upgrading from 1.2 to 1.3 there is no problem doing this.

You can copy the folders counter, xml and cache to the new installation without problems. Missing values in the xml files are automatically created.
IMPORTANT!
The counter files have to be updated before they can be used in Topx. This is done by simple going to the 1.st picture of each folder!
The comments have a different file format for the date - If you use old xml comment files please redownload the latest TWG build and replace the inc/readxml.inc.php! This was not working in the 1st final of 1.3

The harder part is the style sheet and the config.php.
To make it short - you have to do your changes again in the files from TWG 1.3. Please check the other how-to's before you do your settings. Maybe you discover a feature that makes it easier for you to adapt TWG to your needs.
The stylesheet and the config.php can be best merged with a tool like WinMerge. I have made the style sheet much more integration save! Therefore some names in the style sheets have changed. Please use my_style.css for your style settings

I changed the default name of the 'private' file to 'private.txt' because this was asked too much. Please read the security how-to and use password encryption for your passwords!

NEW in 1.4!

You can use a fille called my_config.php! Put your changes to the default 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

24. How to show more images in the DHTML thumbnail strip

If you scroll in the DHTML thumbnail strip you can set the numbers diplayed 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 excange 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 genereted 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! (new 1.3c)

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:

Thats it. If you want to share your skin please ckeck the "Skins" section in the forum. You should provide a screenshot and a zipfile 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.

26. How to include different file formats like avi, mpg ... (new 1.4)

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:

  1. Provide a jpg file that should be used as preview image for your avi file.
  2. 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 webservers work properly with special characters.
  3. 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.
  4. 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.
  5. Copy the two files to your webserver ;).

If you change a watermark image or any setting for it you have to delete the cache!

27. How to configure the hover effects for ie properly (new 1.4)

Internet Explorer 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 (new 1.4)

The image.txt is included on the image detail page. Since 1.4 this file is more powerful because it is included in 3 different positions and is parsed like a normal php file. The whole description to work with the language dependent versions of the files as well - see how-to 7.

1. Positions: 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. But "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! Furhermore I recommend to use a div with a fixed width because IE does sometimes bad rendering and moves the image to the left! In the Demo DHTML folder "Other Formats" is a div with the width 180px used.

2. image.txt is no simply read anymore like folder.txt or foldername.txt (where only the 1.st line is read!) - it is included like a php file. Therefore you can include everything you like in this file - tables or even php code! You can change the image.txt to image.php if you change the extension in the config.php ($image_file_extension).

You can get the image name by using the variable $image! This makes it possible to include a different file for each image. If you plan to do this you should not use the dhtml solution because it does not reload the page!

29. How to configure the HTML_SIDE big navigation (new 1.4)

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 safemode any why is this a problem ;) (new 1.4)

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 managment and restrictions because of the savemode!

  1. 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.
  2. 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 normaly 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 webserver. 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 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 (new 1.4.1)

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.

Then you have to have all your changes to TWG either in the my_config.php, the my_style.css or of yourse 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 subfolder twg. I think you don't like that! Please use the normal zip version then.

Updating itself is very easy

  1. Upload the 3 files from the download that start with 'install'
  2. Check if the twg folder has 777 as permissions - if not please change that!
  3. Start install.php - - READ if anything is red!
  4. 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 ;).

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!

Have fun updating TWG!

32. How to add big folder descripions like in demo 2 (new 1.4.2) - registered version only

You can add folder descriptions to the left and right of the folder images/collage. You can use two files wher 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 the normale folder description is not displayed anymore!

How to use the lightbox feature (new 1.4.2)- registered version only

TWG has integrated the lighbox script for registered users. This feature can be activated at 3 points:

You can set this parameters in the my_config.php (copy them from config.php) or add them in the additional tab of the TWG Admin configuration. Please do not modify my_config.php if you want to manage TWG with the TWG Admin because otherwise you settings get overwritten! If you want to change the colors of the lightbox script please change the lighbox/css/lightbox.css.

Thanks to Lokesh Dhakar for the Lighbox script + the users from the blog that added some nice features to it (+ me who added some more features ;)).

 

FAQ (English only!)

The images/directories are not shown at all or only some are shown

If you have set the right file permissions there can be a problem with your php memory limit. If you have original images with ~ 1MB the needed intern memory is ~10MB (Open a jpg e.g. in Paint Shop Pro or Photoshop and check the memory usage of your image). Call the file info.php in the TWG main directory. It shows you the php-settings of your system. If your memory limit is lower than the limit you need for your pictures you have to increase this limit or make your images smaller.

OR - If all images are missing: Have you enabled the "text on image" feature. If yes maybe the FreeType lib isn't installed on your system (call info.php section gd). Set $print_text to false and retry - If the images are shown please use the $print_watermark switch. I will try to detect if the print_text does not work in one of the next releases.

OR - TWG is caching everything from the file system in the session - close your browser and try again!

I get an error message when running TWG the first time.

Please go to the installation page and check how to install TWG. Maybe you forgot to set the file permissions correctly.

Some of the images are completely black on the thumbnail view

You have maybe opened the gallery during uploading the images. Just delete the cache folder and retry.

Deleting the cache

Deleting the cache dows not mean to delete all the files which are in there. It means to delete all the images that are in there! There are also .rot files where the rotation of images are stored :). If you want to remove stupid rotations - delete all files in this folder except the index.htm!

You wrote that you removed all the cookies - but when I go to the gallery a cookie is set!

That's right - TWG does not use any cookies to store information but php does to track your session. If you don't allow this cookie you can't login or change any settings. But you can refuse this cookie and still use everything of TWG. TWG is designed to run without cookies if the php installation is setting a parameter in the php.ini. If the administrator of the gallery is able to set the flag 'session.use_trans_sid = 1' the urls get a sessionid. Then you can refuse the cookie and still use the whole functionality. If not you should allow your browser to accept this one cookie.

I want to sort my images by the date the picture is taken (using exif data) - what do I have to set on my server?

TWG tries so sort your images after the time the picture is taken. Therefore it need to read exif information from the image. This function is only available in PHP 4 compiled using --enable- exif (call the info.php of TWG and check your php settings). Its functionality and behavior has changed in PHP 4.2. Earlier versions are very unstable. There a a couple of libraries in the www that can read the information without --enable- exif but I have tried some and didn't get better results reading the time the picture was taken (my own camera does not have exif data I can use :(). If no proper data can be read the file time is used. If --enable-exif is not set the file time is used as well.

How can I reset/change the image view counter/caption/comments?

Maybe you want to reset/change the image view counter. The counter files are stored in the xml directory and have the format <twg_album>_image_counter.xml. Each directory has its own counter file. If you remove the file a new one is created the next time a picture of the twg_album is called. You can also modify it with a text editor to maybe reduce a stupid counter value.
The xml directory does also hold the captions (<twg_album>_image_text.xml) and the comments (<twg_album>_album_kommentar.xml). You can delete this files if you want to reset the entries. If you modify something with a texteditor there please be careful because the text is stored encoded there (xml does not like something like & ;)).

I want to test TinyWebGallery at my system at home. Is there a easy way to do this?

Yes there is. There is a great project called xampp that has a ready to go package of an actual Apache with installed PHP (and much more). Just go to http://www.apachefriends.org/de/xampp-windows.html and download the package. You have only to execute a batch file to start the Webserver (if you download the zip file!). Simply unpack the TWG into the htdocs directory of xampp and you are ready to go.

Exif information is not shown in TWG but the Windows Explorer does. Why?

Exif information is stored differently by each camera type. The exif reader that is used is looking at a defined set of offsets and tries to extract the information. Windows explorer (and other tools) do just know more offsets than the small php class ;). I have this problem too depending which program I use to process my images. If the images don't work download the freeware version of cam2pc (http://www.nabocorp.com) and resize the image with the flag "copy metadata" set. Use as size a size bigger than your images if you don't want to resize! This nice tool copies the exif data to a place the exif reader con find it ;).

The exif reader is the same coppermine gallery uses. Therefore I want to thank coppermine programmers and the initial developer of the exif class who released this under the GNU General Public License!