Property | Type | Description | |
---|---|---|---|
$config | Configuration array. | ||
$dirs | Array of directory information. |
Method | Description | |
---|---|---|
ImageManager ( array $config ) | Constructor. Create a new Image Manager instance. | |
_delDir ( string $relative ) : boolean | Delete directories recursively. | |
_delFile ( string $relative ) : boolean | Delete the relative file, and any thumbnails. | |
_dirs ( string $base, string $path ) : array | Recursively travese the directories to get a list of accessable directories. | |
_processFiles ( string $relative, array $file ) : boolean | 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. | |
countFiles ( $path ) | Count the number of files and directories in a given folder minus the thumbnail folders and thumbnails. | |
deleteDirs ( ) : boolean | Delete and specified directories. | |
deleteFiles ( ) : boolean | Delete and specified files. | |
getBaseDir ( ) : string | Get the base directory. | |
getBaseURL ( ) : string | Get the base URL. | |
getDefaultThumb ( ) : string | Get the default thumbnail. | |
getDirs ( ) : array | Get the sub directories in the base dir. | |
getFileURL ( string $relative ) : string | Get the URL of the relative file. | |
getFiles ( string $path, $articleId ) : array | Get all the files and directories of a relative path. | |
getFullPath ( string $relative ) : string | Get the fullpath to a relative file. | |
getImageByNumber ( $articleId, $imageNumber ) | ||
getImageInfo ( string $file ) : array | Get image size information. | |
getThumbName ( string $fullpathfile ) : string | For a given image file, get the respective thumbnail filename no file existence check is done. | |
getThumbURL ( string $relative ) : string | Similar to getThumbName, but returns the URL, base on the given base_url in config.inc.php | |
getThumbnail ( string $relative ) : string | Get the thumbnail url to be displayed. | |
getTmpPrefix ( ) : string | Get the tmp file prefix. | |
isThumb ( string $file ) : true | Check if the file contains the thumbnail prefix. | |
isThumbDir ( string $entry ) : true | Check if the given directory is a thumbnail directory. | |
isTmpFile ( string $file ) : boolean | Check if the given file is a tmp file. | |
isValidBase ( ) | ||
processNewDir ( ) : boolean | Create new directories. | |
processUploads ( ) : null | Process uploaded files, assumes the file is in $_FILES['upload'] and $_POST['dir'] is set. | |
validRelativePath ( string $path ) : boolean | Check if the given path is part of the subdirectories under the base_dir. |
public ImageManager ( array $config ) | ||
$config | array | configuration array, see config.inc.php |
public countFiles ( $path ) |
public deleteDirs ( ) : boolean | ||
return | boolean | true if delete, false otherwise |
public deleteFiles ( ) : boolean | ||
return | boolean | true if delete, false otherwise |
public getBaseDir ( ) : string | ||
return | string | base dir, see config.inc.php |
public getBaseURL ( ) : string | ||
return | string | base url, see config.inc.php |
public getDefaultThumb ( ) : string | ||
return | string | default thumbnail, empty string if the thumbnail doesn't exist. |
public getFileURL ( string $relative ) : string | ||
$relative | string | a file the relative to the base_dir |
return | string | the URL of the relative file. |
public getFiles ( string $path, $articleId ) : array | ||
$path | string | relative path to be base path. |
return | array | of file and path information.
array(0 => array('relative'=>'fullpath',...),
1 => array('filename'=>fileinfo array(),...)
fileinfo array:
array('url'=>'full url',
'relative'=>'relative to base',
'fullpath'=>'full file path',
'image'=>imageInfo array() false if not image,
'stat' => filestat)
|
public getFullPath ( string $relative ) : string | ||
$relative | string | the relative file. |
return | string | the full path, .ie. the base_dir + relative. |
public getImageInfo ( string $file ) : array | ||
$file | string | the image file |
return | array | of getImageSize information, false if the file is not an image. |
public getThumbName ( string $fullpathfile ) : string | ||
$fullpathfile | string | the full path to the image file |
return | string | of the thumbnail file |
public getThumbURL ( string $relative ) : string | ||
$relative | string | the relative image file name, relative to the base_dir path |
return | string | the url of the thumbnail |
public getThumbnail ( string $relative ) : string | ||
$relative | string | the relative image file. |
return | string | the url of the thumbnail, be it actually thumbnail or a script to generate the thumbnail on the fly. |
public getTmpPrefix ( ) : string | ||
return | string | tmp file prefix. |
public isThumbDir ( string $entry ) : true | ||
$entry | string | directory name |
return | true | if it is a thumbnail directory, false otherwise |
public processNewDir ( ) : boolean | ||
return | boolean | true if created, false otherwise. |
public processUploads ( ) : null | ||
return | null |
public validRelativePath ( string $path ) : boolean | ||
$path | string | the relative path to be checked |
return | boolean | true if the path exists, false otherwise |