1.44 build 177
Please rate DAlbum at HotScripts.com
Please rate DAlbum at @ PHP-Resource.de
Rate DAlbum @ The PHP Resource Index
Script Rating:
Create your own   

With some programming experience (in any language - PHP is very easy), you can easily create your own customizations. DAlbum code is small and simple - no need to scan megabytes of code to find out how it works. include/album.php and sometimes include/functions.php will give you enough information about the script to create your own customizations. There is no formal documentation, but there are code comments. Some more details follow.

A good customization only modifies configuration files and does not change original installation files. That makes upgrades very easy and almost automatic.

If you have created a cool DAlbum customization, custom stylesheets etc. you would like to share with other people, please send it to me or write to forum. I will be happy to add it to samples and give you credits.

Very short summary

  • DAlbum class tree is very simple and consists of two classes - CAlbum and CImage, which are both derived from one class - CBaseObject. CAlbum class has an m_arrContents attribute, that contains all sub-albums and images the album contains. You can derive your own classes from CAlbum and CImage and add customCreateImage and customCreateAlbum functions to custom.php to create objects of derived classes.
  • Reindex scans all pictures folders, builds album tree and saves it to .private/.album_index.dat file. Only CAlbum-derived objects are saved in this file to keep it as small as possible. CImage-derived objects are added to album every time it is displayed by calling CAlbum::LoadImages() method.
  • CAlbum object load and parses .albumdef.ini files for album names, comments and image descriptions. .albumdef.ini may also contain custom fields for albums and images.

How index.php is displayed?

  1. Include files and config/custom.php file are loaded.
  2. Complete tree of albums generated during reindex is downloaded from .private/.album_index.dat file. Root album is stored in $albRoot variable.
  3. If a folder name is specified in page URL, CAlbum object corresponding to this folder is searched using $albRoot->FindAlbum() method. Current album is stored in $album variable.
  4. $album->LoadImages() method is called to list all images in album directory and add them to album object.
  5. $album->BeforeDisplay() method is called on the current album. It's default implementation does nothing, but you can override it to do smth. useful. For example, change number or thumnbail columns or load album comments from a database.
  6. A set of template parameters is prepared (header, javascript tree code etc.) and stored them in $_template array.
  7. Page template is included from t_index.php. This page has access to all variables set by index.php page - current album ($album), root album ($albRoot) etc. Complete page including headers and footers is obtained from t_index.php - you define all page completely and it's up to you whether use or not use prepared template arguments in $_template.

How showimg.php is displayed?

  1. Include files and config/custom.php file are loaded.
  2. Complete tree of albums generated during reindex is downloaded from .private/.album_index.dat file. Root album is stored in $albRoot variable.
  3. Album containing the displayed image is found ($album), its images loaded ($album->LoadImages()) and and a CImage object ($image) correspoding to the file in URL is searched.
  4. $image->BeforeDisplay() method is called on the current image.
  5. A set of template parameters is prepared (header, navigation buttons etc.) and stored them in $_template array.
  6. Page template is included from t_showimg.php. This page has access to all variables set by showimg.php page - current album ($album), root album ($albRoot), image ($image) etc.