Configuration basics

# Default output configuration

Let's look at what's the script doing in a default state, without any additional parameters.

  1. First the script checks for all sorts of things:
    1. Does the gallery folder exist?
    2. Is it writable?
    3. Are there any images in the gallery with accepted types? By default script accepts JPEGPNG and GIF files.
  2. If image thumbnails don't exist, they are created:
    1. Default thumbnail size is 210 x 140 px.
    2. Thumbnails are cropped by default.
  3. If previews don't exist, they are created
    1. Default previews dimensions box is 800 x 700 px. Big images are scaled to fit inside this box.
    2. Big images ≠ original images. Original images are left untouched.
  4. HTML output is generated and printed out:
    1. <img> tags are HTML by default.
    2. Image alt attributes and link title attributes are created by humanizing file names. So 'cute_puppy.jpg' file name will result in 'Cute Puppy' alt and title.
    3. Link rel attribute is set to ds_gallery.

If your file structure looks like this:

/ds_galleries
/css
/images
/js
dsg.php
index.php

Default script usage will create dynamic_thumbnails & dynamic_previews folders automatically for you:

/ds_galleries
  /dynamic_thumbnails
  /dynamic_previews
/css
/images
/js
dsg.php
index.php

Cached thumbnails will be stored in dynamic_thumbnails folder, and cached previews in dynamic_previews folder. This way all of the original images will be left intact. This is good especially if your original images come straight from the camera.

Standard script call:

<?php include 'dsg.php'; ?>

Is equal to the one below, written with default configuration parameters. They both produce the same output:

<?php
  $dsg_gallery_dir = 'ds_galleries';
  $dsg_thumbs_dir = 'dynamic_thumbnails';
  $dsg_previews_dir = 'dynamic_previews';
  $dsg_allow_gif = TRUE;
  $dsg_allow_jpg = TRUE;
  $dsg_allow_png = TRUE;
  $dsg_xhtml = FALSE;
  $dsg_preview_width = 800;
  $dsg_preview_height = 700;
  $dsg_thumb_width = 210;
  $dsg_thumb_height = 140;
  $dsg_thumb_operation = 'crop';
  $dsg_compression = 80;
  $dsg_line_pattern = '<li><a href="{PREVIEW_URL}" title="{ORIGINAL_FILENAME_HUMANIZED}"><img src="{THUMB_URL}" width="{THUMB_WIDTH}" height="{THUMB_HEIGHT}" alt="{ORIGINAL_FILENAME_HUMANIZED}"{SELFCLOSE}></a></li>{NEWLINE}';
  $dsg_force_refresh = FALSE;
  $dsg_auto_output = TRUE;
  $dsg_pagination_per_page = NULL;
?>
...
<?php include 'dsg.php'; ?>

As noted before, by default Dead Simple Gallery outputs a list of image thumbnails, each contained within a link pointing to the big version of the image:

<li>
  <a href="ds_galleries/dynamic_previews/dog_c80_scale_800_700.jpg" title="Dog">
    <img src="ds_galleries/dynamic_thumbnails/dog_c80_crop_210_140.jpg" width="210" height="140" alt="Dog">
  </a>
</li>
...