Location: PHPKode > scripts > PiwiP > piwip/readme.txt
PiwiP (PiwiP isn't written in PHP) is a simple picture gallery. You can run
it on a php-server while the pictures are on another picture-server. It is
essential that the picture-server allows directory-listing!
PiwiP does not use a database (like mysql). All comments/explanations (except
this file and the GNU License) are in German.


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

Copyright 2004 Tai Gerstberger
PiwiP is distributed under the terms of the GNU General Public License

Thanks for great ideas and great help to TOBIAS THALMEIER (http://tt-home.de).

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


A short introduction:
   1. Be sure your picture-server has activated directory listing.
   2. Be sure no index.html (or index.htm) is in the (sub)directory of the
      gallery-path on the picture-server.
   3. You can use png, jpg, gif or bmp files.
   4. Adjust the url of the picture-server ($initialurl) in piwip.conf.
   5. Adjust the path of the include-directory ($includepath) in piwip.conf.
   6. Adjust the path of piwip.conf in index.php and gallery.php.
   7. See known bugs (at the end of this text).


Once installed it is for administrators very easy to expand the gallery, just
create a directory with pictures on the picture-server (or add/change/delete
some picture in an existing directory). The name of the directory will be shown
in the html-output.


To understand the construction of this gallery an example follows:

directory-structure on the picture-server (example.com):

http://example.com/user27/Gallery/
http://example.com/user27/Gallery/index.html  <- DELETE THIS FILE !!!
http://example.com/user27/Gallery/Holidays/
http://example.com/user27/Gallery/Holidays/Eastern/
http://example.com/user27/Gallery/Holidays/Eastern/silly_file_with_no_effect.txt
http://example.com/user27/Gallery/Holidays/Eastern/silly_file_in_html_with_no_effect.html
http://example.com/user27/Gallery/Holidays/Eastern/picture1.png
http://example.com/user27/Gallery/Holidays/Eastern/picture2.png
http://example.com/user27/Gallery/Holidays/Eastern/picture3.png
http://example.com/user27/Gallery/Holidays/Eastern/picture4.png
http://example.com/user27/Gallery/Holidays/Eastern/picture5.png
http://example.com/user27/Gallery/Holidays/Christmas/
http://example.com/user27/Gallery/Holidays/Christmas/picture1.jpg
http://example.com/user27/Gallery/Holidays/Christmas/picture2.jpg
http://example.com/user27/Gallery/Meetings/
http://example.com/user27/Gallery/Meetings/example1.bmp
http://example.com/user27/Gallery/Meetings/example2.bmp
http://example.com/user27/Gallery/Meetings/20040515/
http://example.com/user27/Gallery/Meetings/20040515/room.jpg
http://example.com/user27/Gallery/Meetings/20040515/person1.jpg
http://example.com/user27/Gallery/Meetings/20040515/person2.jpg
http://example.com/user27/Gallery/Meetings/20040515/person3.jpg
http://example.com/user27/Gallery/Meetings/20040515/lunch.jpg
http://example.com/user27/Gallery/Meetings/20040626/
http://example.com/user27/Gallery/Meetings/20040626/index.htm  <- DELETE THIS FILE !!!
http://example.com/user27/Gallery/Meetings/20040626/pic1.jpg
http://example.com/user27/Gallery/Meetings/20040626/pic2.jpg

Once adjusted the url ($initialurl) in piwip.conf (in the example the path ist
http://example.com/user27/Gallery/) all directories will be listet automatically,
something like this (if you open the index.php on your php-server, for example
type in your Browser (e.g. Mozilla) http://php-server.net/user95/index.php):

---------------------------------------------------------------------------------
| 				    Gallery					|
|-------------------------------------------------------------------------------|
| Holidays	Browse								|
| Meetings	Browse		Pictures portrait	Pictures landscape	|
---------------------------------------------------------------------------------


Explanation: "Holidays" has one or more subdirectories, so you can choose "Browse".
There are no pictures in the directory "Holidays" (only in the subdirectories), so
you cannot choose "Pictures portrait" or "Pictures landscape".

"Meetings" has one or more subdirectories, so you can choose "Browse". There are
pictures in the directory "Meetings" (example1.bmp and example2.bmp), so you can
choose "Pictures portrait" or "Pictures landscape". If this occurs (subdirectory
and pictures) be sure the subdirectories are listed BEFORE the pictures (see
known bugs).

Be aware that there will always be shown "Pictures portrait" and "Pictures
landscape" even if all pictures in this directory are portrait (or vice versa
landscape)!

A square picture will be shown in "Pictures portrait" AND "Pictures landscape"!

Be aware that the names of the directories (in the above case "Holidays" and
"Meetings") will be shown in the output.

Clicking on "Browse" right to "Holidays" will create a new html output like this:

---------------------------------------------------------------------------------
| 				    Holidays					|
|-------------------------------------------------------------------------------|
| Eastern			Pictures portrait	Pictures landscape	|
| Christmas			Pictures portrait	Pictures landscape	|
---------------------------------------------------------------------------------


"Eastern" (and also "Christmas") has no subdirectory, so you cannot choose "Browse".
There are pictures in the directory "Eastern", so you can choose "Pictures portrait"
or "Pictures landscape".

You can open directly the above windows by typing in the Browser
http://php-server.net/user95/index.php?subdir=Holidays (you can also type in more
subdirectories like http://php-server.net/user95/index.php?subdir=Holidays/Eastern).
This is useful if you want to send the direct link to friends.

Clicking on "Pictures landscape" right to "Eastern" will show a picture-gallery with
all pictures in landscape (lets say pictures 1, 3, 4 and 5 are landscape, then the
output will be something like this:

		-----------------		-----------------
		|		|		|		|
		| picture1.png	|		| picture3.png	|
		|		|		|		|
		-----------------		-----------------


		-----------------		-----------------
		|		|		|		|
		| picture4.png	|		| picture5.png	|
		|		|		|		|
		-----------------		-----------------


You can open directly the above picture-gallery in landscape by typing in the Browser
http://php-server.net/user95/gallery.php?subdir=Holidays/Eastern (typing
http://php-server.net/user95/gallery.php?subdir=Holidays/Eastern&align=portrait will
show the picture-gallery in portrait).


There is no index.html (or index.htm) allowed in the directories of the picture-server.
It IS allowed on the PHP-Server AND on the picture-server when they are not in the
gallery-path (for example http://example.com/user27/index.html)!


PiwiP is programmed in PHP. The System was Linux 2.4.20-4GB-athlon (SuSE Linux 8.2
Professional) with KWrite 4.1 (KDE 3.1.1). Tested with Apache 1.3.27, PHP 4.3.1,
Konqueror 3.1.1 (KDE 3.1.1) and Mozilla 1.6. FTP-Transfer by FileZilla 2.2.8b.


Known bugs:
   1. Be aware that there will always be shown "Pictures portrait" and "Pictures
      landscape" even if all pictures in this directory are portrait (or vice versa
      landscape).
   2. A square picture will be shown in the gallery "Pictures portrait" AND in the
      gallery "Pictures landscape".
   3. An empty subdirectory (without pictures an furthermore subdirectories) will
      be shown in the html-output.
   4. If the memory is too small the following warning will be shown:
      Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 (tried
      to allocate 4000001 bytes) in /home/www/user95/html/index.php on line 357
      In a test with 8 MB Ram and $subject = fread($fp,4000000); this error occured.
      I do not know why 8 MB are not enough for reading some simple html-pages.
      Two possible solutions:
         a) Change the value of fread($fp,xxx).
	 b) Increase memory_limit in php.ini.
   5. The PHP-Server may split the read html-pages into several pieces (this may is
      in combination with bug Nr. 4). Therefore the lines
      if ($comparedirectory == $gallerydirectory) and if ($comparedirectory == $newdirectory)
      were programmed. Only the first piece is read, the other pieces are ignored
      to avoid bugs. If there are in a directory pictures and subdirectories and
      the subdirectories are listed after the pictures the subdirectories may be
      ignored.
      Solution:
         Rename the subdirectories in a way that they are listed BEFORE the
	 pictures (for example prefix a space character, a hyphen or three zeros;
	 an underscore will not help).
Return current item: PiwiP