Docs For Class ImageThumbnailWidget

## Class ImageThumbnailWidget

Description

This widget creates a N by x visual table of thumbnails.

- author: Walter A. Boring IV <waboring@newsblob.com>

Located in /widgets/ImageThumbnailWidget.inc (line 20)

    Container
       |
       --BaseWidget
          |
          --ImageThumbnailWidget

Variable Summary
mixed $_columns
mixed $_global_prefix
mixed $_offsetVar
mixed $_supported_image_types
Method Summary
ImageThumbnailWidget ImageThumbnailWidget ([int $width = 760], [int $cols = 5], [mixed $filedir = NULL], [mixed $urldir = NULL])
void build_filelist ()
void build_link_td (mixed $file)
void build_page_control ()
void build_thumbnails ()
void build_thumbnail_file (mixed $file, string $filename)
void build_thumb_table ()
void getdirlist (mixed $dir)
void get_supported_image_formats ()
boolean is_last_page (int $offset)
int items_per_page ()
int item_index (mixed $offset)
int num_items_on_page (int $offset)
int num_pages ()
int offset ()
void push (mixed $url, mixed $text, [mixed $selected = FALSE])
void push_blank ([mixed $num = 1])
void push_text (mixed $text, [mixed $selected = FALSE])
string render ([int $indent_level = 1], int $output_debug)
int rows_per_page ()
void set_cols (mixed $cols)
void set_filedir (mixed $dir)
void set_global_prefix (string $prefix)
void set_maxthumbs_per_page ([mixed $num = 10])
void set_thumbnail_dimensions ([int $width = 50], [int $height = 50])
void set_thumbnail_script (mixed $script)
void set_urldir (mixed $dir)
void strip_offset (mixed $query_string)
void test_maxthumbs_per_page ()
int total_items ()
void write_thumb_to_disk (mixed $file, mixed &$img, mixed $type)
void _create_thumbnail_cache_dir ()
void _get_file_type (mixed $file, string $filename)
Variables
mixed $_columns (line 64)

The number of columns for a page.

mixed $_global_prefix = '' (line 99)

holds the prefix for all variables that are added to a url, so we can possibly have more then 1 of these per page.

mixed $_offsetVar = 'offset' (line 106)

Holds the name of the offset variable. It's prefixed w/ the _global_prefix var.

mixed $_supported_image_types = array("WBMP" => FALSE,
"PNG" => FALSE,
"JPG" => FALSE,
"GIF" => FALSE) (line 86)

Array of supported image type flags.

#### Inherited Variables

Inherited from BaseWidget

> BaseWidget::$title
> BaseWidget::$width
> BaseWidget::$_image_prefix

Methods
Constructor ImageThumbnailWidget (line 121)

Constructor for this class It just sets the width for the widget.

ImageThumbnailWidget ImageThumbnailWidget ([int $width = 760], [int $cols = 5], [mixed $filedir = NULL], [mixed $urldir = NULL])

- int $width: - the width of the widget
- int $cols: - the number of columns of images the default is 5.

build_filelist (line 364)

build the list of images

from a directory on disk

void build_filelist ()
build_link_td (line 400)

build the link td.

void build_link_td (mixed $file)
build_page_control (line 435)
void build_page_control ()
build_thumbnails (line 567)

this function builds a cache dir of thumbnails, so we don't have to render thumbnails every time we hit the thumbnails page.

void build_thumbnails ()
build_thumbnail_file (line 593)

Builds a thumbnail version of a file, and writes it to disk.

void build_thumbnail_file (mixed $file, string $filename)

- string $filename: - the filename to thumbnail

build_thumb_table (line 496)

function that will render the widget.

child class should override this.

void build_thumb_table ()
getdirlist (line 370)
void getdirlist (mixed $dir)
get_supported_image_formats (line 232)

This tests to see what type of gd lib image format this server supports.

void get_supported_image_formats ()
is_last_page (line 316)

Is thie offset for the last page?

- return: TRUE:FALSE

boolean is_last_page (int $offset)

- int $offset: - page offset

items_per_page (line 282)

Calculate the # of items on a page.

int items_per_page ()
item_index (line 353)

Calculate the item # for the offset.

int item_index (mixed $offset)
num_items_on_page (line 338)

Calculate the # of items to on a particular page.

- return: - # of items on offset's page.

int num_items_on_page (int $offset)

- int $offset: - page offset #

num_pages (line 297)

Calculate the number of

pages possible for this list of thumbnails. It depends on the # of columns, and the max thumbs per page, and the total.

- return: - # of pages.

int num_pages ()
offset (line 250)

Get the current value of the offset var

- return: - the page offset

int offset ()
push (line 133)
void push (mixed $url, mixed $text, [mixed $selected = FALSE])

Redefinition of:

Container::push()
  Same as add().

push_blank (line 138)
void push_blank ([mixed $num = 1])
push_text (line 143)
void push_text (mixed $text, [mixed $selected = FALSE])
render (line 538)

Render the entire widget. this includes the page offset links, as well as the thumbnails.

- return: the raw html output.

string render ([int $indent_level = 1], int $output_debug)

- int $indent_level: - the indentation level for the container.
- int $output_debug: - the output debug flag to maintain compatibility w/ the API.

Redefinition of:

Container::render()
  This function is compatible with the rest of the phpHtmllib API spec.

rows_per_page (line 264)

Calculates the # of rows per page possible.

int rows_per_page ()
set_cols (line 192)

set how many columns the user wants to display per row of thumbnails.

void set_cols (mixed $cols)
set_filedir (line 175)

Set the full path on disk where the images live.

void set_filedir (mixed $dir)
set_global_prefix (line 156)

This function sets a prefix for all variables that are used in the item list table on a page. This allows you to have multiple itemlists on a single html page.

void set_global_prefix (string $prefix)

- string $prefix: - the prefix for all vars.

set_maxthumbs_per_page (line 200)

set how many thumbnails to display per page.

void set_maxthumbs_per_page ([mixed $num = 10])
set_thumbnail_dimensions (line 221)

Sets all thumnail dimensions.

void set_thumbnail_dimensions ([int $width = 50], [int $height = 50])

- int $width: - thumbnail width
- int $height: - thumbnail height

set_thumbnail_script (line 166)

Set the url for the thumbnail generation script.

void set_thumbnail_script (mixed $script)
set_urldir (line 184)

Set the base url path where the files live on the web site.

void set_urldir (mixed $dir)
strip_offset (line 419)

This function strips the offset

void strip_offset (mixed $query_string)
test_maxthumbs_per_page (line 209)

Make sure the maxthumbsperpage isn't > then total items.

void test_maxthumbs_per_page ()
total_items (line 327)

returns the total # of items we have to display.

- return: - total items.

int total_items ()
write_thumb_to_disk (line 661)

write the image to disk.

We assume we have write permissions to the images dir.

void write_thumb_to_disk (mixed $file, mixed &$img, mixed $type)
_create_thumbnail_cache_dir (line 682)

Try and create the thumbnail cache dir.

void _create_thumbnail_cache_dir ()
_get_file_type (line 638)

discover the type of image based off of the extension

void _get_file_type (mixed $file, string $filename)

- string $filename: - the filename

#### Inherited Methods

Inherited From BaseWidget

> BaseWidget::get_align()
> BaseWidget::get_css()
> BaseWidget::get_javascript()
> BaseWidget::get_title()
> BaseWidget::get_width()
> BaseWidget::set_align()
> BaseWidget::set_image_path_prefix()
> BaseWidget::set_title()
> BaseWidget::set_width()

Inherited From Container

> Container::Container()
> Container::add()
> Container::add_reference()
> Container::count_content()
> Container::get_element()
> Container::get_indent_flag()
> Container::push()
> Container::push_reference()
> Container::render()
> Container::reset_content()
> Container::set_collapse()
> Container::set_indent_flag()

Documentation generated on Thu, 1 Sep 2005 17:06:04 -0700 by phpDocumentor 1.3.0RC3