Class ImageThumbnailWidget

Description

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

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

Container
   |
   --BaseWidget
      |
      --ImageThumbnailWidget
Variable Summary
Method Summary
ImageThumbnailWidget ImageThumbnailWidget ([int $width = 760], [int $cols = 5], [ $filedir = NULL], [ $urldir = NULL])
void build_filelist ()
void build_link_td ( $file)
void build_thumbnail_file ( $file, string $filename)
void getdirlist ( $dir)
boolean is_last_page (int $offset)
int item_index ( $offset)
int num_items_on_page (int $offset)
int num_pages ()
int offset ()
void push ( $url,  $text, [ $selected = FALSE])
void push_blank ([ $num = 1])
void push_text ( $text, [ $selected = FALSE])
string render ([int $indent_level = 1], [int $output_debug = 0])
int rows_per_page ()
void set_cols ( $cols)
void set_filedir ( $dir)
void set_global_prefix (string $prefix)
void set_maxthumbs_per_page ([ $num = 10])
void set_thumbnail_dimensions ([int $width = 50], [int $height = 50])
void set_thumbnail_script ( $script)
void set_urldir ( $dir)
void strip_offset ( $query_string)
int total_items ()
void write_thumb_to_disk ( $file,  &$img,  $type)
void _get_file_type ( $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], [ $filedir = NULL], [ $urldir = NULL])
  • int $width: - the width of the widget
  • int $cols: - the number of columns of images the default is 5.
  • $filedir
  • $urldir
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 ( $file)
  • $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 ( $file, string $filename)
  • string $filename: - the filename to thumbnail
  • $file
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 ( $dir)
  • $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 ( $offset)
  • $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 ( $url,  $text, [ $selected = FALSE])
  • $url
  • $text
  • $selected

Redefinition of:
Container::push()
Same as add().
push_blank (line 138)
void push_blank ([ $num = 1])
  • $num
push_text (line 143)
void push_text ( $text, [ $selected = FALSE])
  • $text
  • $selected
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 = 0])
  • 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 ( $cols)
  • $cols
set_filedir (line 175)

Set the full path on disk where the images live.

void set_filedir ( $dir)
  • $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 ([ $num = 10])
  • $num
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 ( $script)
  • $script
set_urldir (line 184)

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

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

This function strips the offset

void strip_offset ( $query_string)
  • $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 ( $file,  &$img,  $type)
  • $file
  • &$img
  • $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 ( $file, string $filename)
  • string $filename: - the filename
  • $file

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 Fri, 28 Jan 2011 08:53:09 -0500 by phpDocumentor 1.4.3