Class ImageManager

Description

ImageManager Class.

  • author: $Author$
  • version: $Id$

Located in /mambots/editors/mostlyce/jscripts/tiny_mce/imagemanager/Classes/ImageManager.php (line 16)


	
			
Variable Summary
 mixed $config
 mixed $dirs
Method Summary
 ImageManager ImageManager (array $config)
 void countFiles ( $path)
 boolean deleteDirs ()
 boolean deleteFiles ()
 string getBaseDir ()
 string getBaseURL ()
 string getDefaultThumb ()
 array getDirs ()
 array getFiles (string $path)
 string getFileURL (string $relative)
 string getFullPath (string $relative)
 array getImageInfo (string $file)
 string getThumbnail (string $relative)
 string getThumbName (string $fullpathfile)
 string getThumbURL (string $relative)
 string getTmpPrefix ()
 true isThumb (string $file)
 true isThumbDir (string $entry)
 boolean isTmpFile (string $file)
 void isValidBase ()
 boolean processNewDir ()
 null processUploads ()
 boolean validGraphicMethods (string $library, string $method)
 boolean validRelativePath (string $path)
 boolean _checkGDLibrary ( $method, string $library)
 void _checkIMLibrary ( $method)
 boolean _delDir (string $relative)
 boolean _delFile (string $relative)
 array _dirs (string $base, string $path)
 boolean _processFiles (string $relative, array $file)
Variables
mixed $config (line 21)

Configuration array.

mixed $dirs (line 26)

Array of directory information.

Methods
Constructor ImageManager (line 32)

Constructor. Create a new Image Manager instance.

ImageManager ImageManager (array $config)
  • array $config: configuration array, see config.inc.php
countFiles (line 191)

Count the number of files and directories in a given folder minus the thumbnail folders and thumbnails.

void countFiles ( $path)
  • $path
deleteDirs (line 547)

Delete and specified directories.

  • return: true if delete, false otherwise
boolean deleteDirs ()
deleteFiles (line 537)

Delete and specified files.

  • return: true if delete, false otherwise
boolean deleteFiles ()
getBaseDir (line 41)

Get the base directory.

  • return: base dir, see config.inc.php
string getBaseDir ()
getBaseURL (line 50)

Get the base URL.

  • return: base url, see config.inc.php
string getBaseURL ()
getDefaultThumb (line 472)

Get the default thumbnail.

  • return: default thumbnail, empty string if the thumbnail doesn't exist.
string getDefaultThumb ()
getDirs (line 77)

Get the sub directories in the base dir.

Each array element contain the relative path (relative to the base dir) as key and the full path as value.

  • return: of sub directries
    1. array('path name' => 'full directory path'...)
array getDirs ()
getFiles (line 136)

Get all the files and directories of a relative path.

  • return: of file and path information.
    1. array(0=>array('relative'=>'fullpath',...)1=>array('filename'=>fileinfo array(),...)
    fileinfo array:
    1. array('url'=>'full url',
    2.                        'relative'=>'relative to base',
    3.                         'fullpath'=>'full file path',
    4.                         'image'=>imageInfo array(false if not image,
    5.                         'stat' => filestat)
array getFiles (string $path)
  • string $path: relative path to be base path.
getFileURL (line 452)

Get the URL of the relative file.

basically appends the relative file to the base_url given in config.inc.php

  • return: the URL of the relative file.
string getFileURL (string $relative)
  • string $relative: a file the relative to the base_dir
getFullPath (line 462)

Get the fullpath to a relative file.

  • return: the full path, .ie. the base_dir + relative.
string getFullPath (string $relative)
  • string $relative: the relative file.
getImageInfo (line 221)

Get image size information.

  • return: of getImageSize information, false if the file is not an image.
array getImageInfo (string $file)
  • string $file: the image file
getThumbnail (line 498)

Get the thumbnail url to be displayed.

If the thumbnail exists, and it is up-to-date the thumbnail url will be returns. If the file is not an image, a default image will be returned. If it is an image file, and no thumbnail exists or the thumbnail is out-of-date (i.e. the thumbnail modified time is less than the original file) then a thumbs.php?img=filename.jpg is returned. The thumbs.php url will generate a new thumbnail on the fly. If the image is less than the dimensions of the thumbnails, the image will be display instead.

  • return: the url of the thumbnail, be it actually thumbnail or a script to generate the thumbnail on the fly.
string getThumbnail (string $relative)
  • string $relative: the relative image file.
getThumbName (line 274)

For a given image file, get the respective thumbnail filename no file existence check is done.

  • return: of the thumbnail file
string getThumbName (string $fullpathfile)
  • string $fullpathfile: the full path to the image file
getThumbURL (line 308)

Similar to getThumbName, but returns the URL, base on the

given base_url in config.inc.php

  • return: the url of the thumbnail
string getThumbURL (string $relative)
  • string $relative: the relative image file name, relative to the base_dir path
getTmpPrefix (line 64)

Get the tmp file prefix.

  • return: tmp file prefix.
string getTmpPrefix ()
isThumb (line 231)

Check if the file contains the thumbnail prefix.

  • return: if the file contains the thumbnail prefix, false otherwise.
true isThumb (string $file)
  • string $file: filename to be checked
isThumbDir (line 245)

Check if the given directory is a thumbnail directory.

  • return: if it is a thumbnail directory, false otherwise
true isThumbDir (string $entry)
  • string $entry: directory name
isTmpFile (line 259)

Check if the given file is a tmp file.

  • return: true if it is a tmp file, false otherwise
boolean isTmpFile (string $file)
  • string $file: file name
isValidBase (line 55)
void isValidBase ()
processNewDir (line 598)

Create new directories.

If in safe_mode, nothing happens.

  • return: true if created, false otherwise.
boolean processNewDir ()
processUploads (line 368)

Process uploaded files, assumes the file is in $_FILES['upload'] and $_POST['dir'] is set.

The dir must be relative to the base_dir and exists. If 'validate_images' is set to true, only file with image dimensions will be accepted.

null processUploads ()
validGraphicMethods (line 622)

Do some graphic library method checkings

  • return: true if able, false otherwise.
boolean validGraphicMethods (string $library, string $method)
  • string $library: the graphics library, GD, NetPBM, or IM.
  • string $method: the method to check.
validRelativePath (line 341)

Check if the given path is part of the subdirectories under the base_dir.

  • return: true if the path exists, false otherwise
boolean validRelativePath (string $path)
  • string $path: the relative path to be checked
_checkGDLibrary (line 652)

Check the GD library functionality.

  • return: true if able, false otherwise.
boolean _checkGDLibrary ( $method, string $library)
  • string $library: the graphics library, GD, NetPBM, or IM.
  • $method
_checkIMLibrary (line 638)
void _checkIMLibrary ( $method)
  • $method
_delDir (line 584)

Delete directories recursively.

  • return: true if deleted, false otherwise.
boolean _delDir (string $relative)
  • string $relative: the relative path to be deleted.
_delFile (line 560)

Delete the relative file, and any thumbnails.

  • return: true if deleted, false otherwise.
boolean _delFile (string $relative)
  • string $relative: the relative file.
_dirs (line 96)

Recursively travese the directories to get a list of accessable directories.

  • return: of accessiable sub-directories
    1. array('path name' => 'full directory path'...)
array _dirs (string $base, string $path)
  • string $base: the full path to the current directory
  • string $path: the relative path name
_processFiles (line 399)

Process upload files. The file must be an

uploaded file. If 'validate_images' is set to true, only images will be processed. Any duplicate file will be renamed. See Files::copyFile for details on renaming.

  • return: true if the file was processed successfully, false otherwise
boolean _processFiles (string $relative, array $file)
  • string $relative: the relative path where the file should be copied to.
  • array $file: the uploaded file from $_FILES

Documentation generated on Mon, 05 May 2008 16:20:24 +0400 by phpDocumentor 1.4.0