Class ImageManager

Description

ImageManager Class.

  • version: $Id: ImageManager.php 27 2004-04-01 08:31:57Z Wei Zhuo $
  • author: $Author: Wei Zhuo $

Located in /plugins/ImageManager/Classes/ImageManager.php (line 20)


	
			
Variable Summary
 mixed $config
 mixed $dirs
Method Summary
 ImageManager ImageManager (array $config)
 void countFiles (mixed $path)
 boolean deleteDirs ()
 boolean deleteFiles ()
 string getDefaultThumb ()
 array getDirs ()
 array getFiles (string $path)
 string getFileURL (string $relative)
 string getFullPath (string $relative)
 array getImageInfo (string $file)
 string getImagesDir ()
 string getImagesURL ()
 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 validRelativePath (string $path)
 boolean _delDir (string $relative)
 boolean _delFile (string $relative)
 array _dirs (string $base, string $path)
 boolean _processFiles (string $relative, array $file)
Variables
mixed $config (line 25)

Configuration array.

mixed $dirs (line 30)

Array of directory information.

Methods
Constructor ImageManager (line 36)

Constructor. Create a new Image Manager instance.

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

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

void countFiles (mixed $path)
deleteDirs (line 575)

Delete specified directories.

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

Delete and specified files.

  • return: true if delete, false otherwise
boolean deleteFiles ()
getDefaultThumb (line 482)

Get the default thumbnail.

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

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 140)

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 462)

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 472)

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 225)

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
getImagesDir (line 45)

Get the images base directory.

  • return: base dir, see config.inc.php
string getImagesDir ()
getImagesURL (line 54)

Get the images base URL.

  • return: base url, see config.inc.php
string getImagesURL ()
getThumbnail (line 515)

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 278)

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 312)

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 68)

Get the tmp file prefix.

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

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 249)

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 263)

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 59)
void isValidBase ()
processNewDir (line 639)

Create new directories.

If in safe_mode, nothing happens.

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

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 ()
validRelativePath (line 351)

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
_delDir (line 621)

Delete directories recursively.

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

Delete the relative file, and any thumbnails, if enabled

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

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 409)

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 Sat, 31 Dec 2005 14:56:53 -0500 by phpDocumentor 1.3.0RC3