Class db_images

db_entity
  |
  +--db_images

public class db_images
extends db_entity

Class for Images entity in ArtSys DB.
Contains custom SELECT SQL queries.
Images are stored in two directories on disk: image_dir and upload_dir.

Note: This is Article System specific class.


Constructor Summary
db_images(var $image_dir, var $image_url, var $upload_dir, var $upload_url)
          Contructor of db_images class.
 
Method Summary
 unknown _assigned_column(var $table)
          Return the name of the column containing id.
 unknown _assigned_specification(var $tablename, var $id, var $pref)
          Return part of db query specifying wanted id.
 unknown _assigned_title(var $tablename)
          TODO
 boolean _move(var $id, var $to_uploads, var $filename)
          Move image to or from upload directory.
 unknown assign(var $input)
          Assign image to given item (specified by $table & $id).
 unknown delete(var $id, var $path)
          TODO
 unknown exists(var $id)
          Check physical existence of the image file on disk.
 unknown feed_form_button(var $id, var $filename, var $form, var $item)
          Insert 'use' button, that will feed target form item with the name of image given by id.
 array get_all_assigned(var $table, var $id)
          Return all images assigned to given item (specified by $table & $id).
 array get_assigned(var $table, var $id, var $ident)
          Return image assigned to given item (specified by $table, $id and $ident).
 unknown get_description(var $id)
          Return image description.
 unknown get_destination(var $id)
          Return image "href" parameter aka.
 string get_dir(var $id)
          Returns the directory for an image given by id.
 string get_filename(var $id)
          Returns the filename of an image given by id.
 string get_full_url(var $id, var $filename, var $uploaded)
          Returns full URL for an image given by id.
 string get_id(var $filename)
          Returns id of an image given by filename.
 array get_one_cached(var $id)
          Like get_one, but it caches the results of the last query.
 string get_path(var $id, var $filename, var $uploaded)
          Returns full directory path for an image given by id.
 array get_select_data(var $assoc)
          Returns an associative array with letter for filter.
 unknown get_size_array(var $id, var $width, var $height, var $filetype)
          Return size array as PHP function getimagesize() for image existing in database.
 array get_size(var $id)
          Return array with image sizes.
 unknown get_tag(var $id, var $filename)
          Return image tag.
 string get_url(var $id)
          Returns the URL path for an image given by id.
 array get_window_size(var $w, var $h)
          Return array with window sizes ( * @param $w Image width.
 unknown insert_uploaded(var $filename, var $userid)
          TODO
 boolean is_published(var $id)
          Get state of the image file (it's either 'published' or 'uploaded').
Returns true/false/-1 on error.
 boolean is_unique(var $filename)
          Check, if the filename is unique (for both dirs).
 unknown preview_button(var $id, var $url, var $w, var $h, var $use_taset)
          Insert preview button for this image.
Optional $taset attribute uses special "input.image_controls" value.
 unknown publish(var $id, var $filename)
          TODO
 unknown rename(var $id, var $newfilename, var $oldfilename)
          TODO
 unknown unassign_all(var $table, var $id)
          Un-assign all images from given item.
 unknown unpublish(var $id)
          TODO
 
Methods inherited from class db_entity
delete, error_report, get_assoc, get_error, get_name, get_one, get, select_box
 

Constructor Detail

db_images

public db_images(var $image_dir,
                 var $image_url,
                 var $upload_dir,
                 var $upload_url)
Contructor of db_images class.
Method Detail

get_one_cached

public array get_one_cached(var $id)
Like get_one, but it caches the results of the last query.
Parameters:
$id - int The 'id' value of the image.

get_filename

public string get_filename(var $id)
Returns the filename of an image given by id.
Parameters:
$id - int The 'id' value of the image.

get_id

public string get_id(var $filename)
Returns id of an image given by filename.
Parameters:
$filename - The file name of the image.

get_destination

public unknown get_destination(var $id)
Return image "href" parameter aka. its destination. Note: this is not href of image itself, its href of a link, if this image is used an anchor.
Parameters:
$id - Image id.

get_description

public unknown get_description(var $id)
Return image description.
Parameters:
$id - Image id.

get_assigned

public array get_assigned(var $table,
                          var $id,
                          var $ident)
Return image assigned to given item (specified by $table, $id and $ident).
Parameters:
$table - Table identificator (textual "Issues" / numeric "2")
$id - Item id in given table.
$ident - Textual identificator for this image.

get_all_assigned

public array get_all_assigned(var $table,
                              var $id)
Return all images assigned to given item (specified by $table & $id).
Parameters:
$table - Table identificator (textual "Issues" / numeric "2")
$id - Item id in given table.

get_url

public string get_url(var $id)
Returns the URL path for an image given by id.
Parameters:
$id - Image id.

get_full_url

public string get_full_url(var $id,
                           var $filename,
                           var $uploaded)
Returns full URL for an image given by id.
Parameters:
$id - Image id.
$filename - Default Value: ''
$uploaded - Default Value: ''

get_dir

public string get_dir(var $id)
Returns the directory for an image given by id.
Parameters:
$id - Image id.

get_path

public string get_path(var $id,
                       var $filename,
                       var $uploaded)
Returns full directory path for an image given by id.
Parameters:
$id - Image id.
$filename - Default Value: ''
$uploaded - Default Value: ''

get_tag

public unknown get_tag(var $id,
                       var $filename)
Return image tag.
Parameters:
$id - Image id.
$filename - Given filename of search one.
$filename - Default Value: null

exists

public unknown exists(var $id)
Check physical existence of the image file on disk.
Parameters:
$id - Image id.

is_published

public boolean is_published(var $id)
Get state of the image file (it's either 'published' or 'uploaded').
Returns true/false/-1 on error.
Parameters:
$id - Image id.

get_size

public array get_size(var $id)
Return array with image sizes. Try db first, then disk (fill db in this case). The return value has same format as getimagesize()
Parameters:
$id - Image id.
See Also:
getimagesize()

get_size_array

public unknown get_size_array(var $id,
                              var $width,
                              var $height,
                              var $filetype)
Return size array as PHP function getimagesize() for image existing in database. Parse given arguments, if they are empty, read image params from disk and fill database.
Parameters:
$id - Image id.
$width - Image width.
$height - Image height.
$filetype - Image filetype (integer - index to $this->img_types)
See Also:
getimagesize()

get_window_size

public array get_window_size(var $w,
                             var $h)
Return array with window sizes ( * @param $w Image width.
Parameters:
$h - Image height.

get_select_data

public array get_select_data(var $assoc)
Returns an associative array with letter for filter.
Parameters:
$assoc - is passed by reference

insert_uploaded

public unknown insert_uploaded(var $filename,
                               var $userid)
TODO

assign

public unknown assign(var $input)
Assign image to given item (specified by $table & $id).
Parameters:
$input - Array of data that suits Iusage table.

unassign_all

public unknown unassign_all(var $table,
                            var $id)
Un-assign all images from given item.
Parameters:
$table - Table identificator (textual "Issues" / numeric "2")
$id - Item id in given table.

_move

public boolean _move(var $id,
                     var $to_uploads,
                     var $filename)
Move image to or from upload directory.
Parameters:
$id - Image id.
$to_uploads - Boolean to set rename direction.
$filename - Default Value: ''

publish

public unknown publish(var $id,
                       var $filename)
TODO
Parameters:
$filename - Default Value: ''

unpublish

public unknown unpublish(var $id)
TODO

rename

public unknown rename(var $id,
                      var $newfilename,
                      var $oldfilename)
TODO

delete

public unknown delete(var $id,
                      var $path)
TODO
Parameters:
$path - Default Value: ''

preview_button

public unknown preview_button(var $id,
                              var $url,
                              var $w,
                              var $h,
                              var $use_taset)
Insert preview button for this image.
Optional $taset attribute uses special "input.image_controls" value.
Parameters:
$id - Image id.
$path - Full image url (dir/filename).
$w - Image width.
$h - Image height.
$use_taset - Boolean, true to use global $ASET_LIST object to use for tag output.

feed_form_button

public unknown feed_form_button(var $id,
                                var $filename,
                                var $form,
                                var $item)
Insert 'use' button, that will feed target form item with the name of image given by id. Optional $taset attribute uses special "input.image_controls" value.

is_unique

public boolean is_unique(var $filename)
Check, if the filename is unique (for both dirs).
Parameters:
$filename - Image file name.

_assigned_title

public unknown _assigned_title(var $tablename)
TODO

_assigned_specification

public unknown _assigned_specification(var $tablename,
                                       var $id,
                                       var $pref)
Return part of db query specifying wanted id.
Parameters:
$pref - Default Value: null

_assigned_column

public unknown _assigned_column(var $table)
Return the name of the column containing id.