Class: Media_Object
Source Location: /media_classes/object.class.php
Class Details
[line 38]
Class Variables
Class Methods
constructor __construct [line 59]
Media_Object __construct(
)
|
|
Start instance of base class, load configuration and establish database connection. Please don't call the constructor direcly, use the singleton pattern instead.
Tags:
method addObject [line 85]
int addObject(
array
$sqlData)
|
|
Adds object to the object table. Takes a field=>value array with object data as first argument. Returns insert id.
Tags:
Parameters:
method countObjects [line 417]
array countObjects(
[array
$params = array()])
|
|
Counts objects saved in the media object table. List of supported params: - types, array, optional: Return only objects that belong to the given
generic types
- tags, array, optional: Returns objects with given tags
- timeframe, string, optional: Returns objects from given timeframe
Tags:
Parameters:
method createImageThumbnail [line 631]
array createImageThumbnail(
string
$orig_name, string
$object_name, int
$width, int
$height, [bool
$fill_up = false], [bool
$hex = null])
|
|
Creates thumbnail of given image. Takes the original name (as saved on user's disk) of the object as first argument and the filename of the object on the server as second argument. The arguments three and four define the maximum width and height of the thumbnail. The image will be scaled keeping the aspect ratio of the original image. If the image is smaller than $width or $height and you don't like that, the image will be placed on the middle of an empty canvas with the size of $width x $height if you pass boolean true as fifth argument. The color of the canvas can be defined using a hexadecimal color code as sixth argument (e.g. ffffff for white or ff0000 for red). Returns array with complete array information: - name: Name of the thumbnail on the server's disk
- width: Width of the thumbnail
- height: Height of the thumbnail
- type: MIME type the thumbnail
- size: Filesize of the thumbnail in bytes
Tags:
Parameters:
method deleteObject [line 151]
int deleteObject(
int
$id)
|
|
Removes object from the object table. Takes the object id as first argument. Returns amount of affected rows.
Tags:
Parameters:
method genericTypesToMimeTypes [line 1093]
array genericTypesToMimeTypes(
string
$generic_type)
|
|
Returns list of mime types that belong to the given generic type. Valid generic types: - image
- document
- audio
- video
- other
Tags:
Parameters:
method getGenericTypes [line 1061]
Returns list of generic image types.
Tags:
method getMimeTypeConfigurations [line 1286]
array getMimeTypeConfigurations(
)
|
|
Returns list with mime type configurations.
Tags:
method getPathToObject [line 824]
mixed getPathToObject(
string
$object_name)
|
|
Returns full path to media object. Takes media object name on disk as first argument. Please note that the object doesn't have to exist to get the path to a object.
Tags:
Parameters:
method getPathToObjectUsingId [line 846]
mixed getPathToObjectUsingId(
string
$object_id)
|
|
Takes media object id as first argument. Returns full disk path to media object.
Tags:
Parameters:
method getPathToThumbnail [line 925]
mixed getPathToThumbnail(
string
$object_name)
|
|
Returns full path to media thumbnail. Takes the media object name on disk as first argument. Please note that the thumbnail doesn't have to exist to get the path to the thumbnail.
Tags:
Parameters:
method getWwwPathToObject [line 872]
mixed getWwwPathToObject(
string
$object_name)
|
|
Returns full www path to media object. Takes media object name on disk as first argument. Please note that the object doesn't have to exist to get the path to a object.
Tags:
Parameters:
method getWwwPathToObjectUsingId [line 894]
mixed getWwwPathToObjectUsingId(
string
$object_id)
|
|
Takes media object id as first argument. Returns full www path to media object.
Tags:
Parameters:
method imageStoreIsReady [line 945]
bool imageStoreIsReady(
)
|
|
Tests if the image store is ready to save some files there.
Tags:
method isPodcastFormat [line 1127]
bool isPodcastFormat(
string
$mime_type)
|
|
Tests if object with given mime type can be used for a podcast. Returns bool.
Tags:
Parameters:
method mimeTypeToIcon [line 1223]
string mimeTypeToIcon(
string
$mime_type)
|
|
Returns name of a fancy icon for the given mime type. Takes the mime type name as first argument. If the given mime type could not be found, the name of a generic icon will be returned.
Tags:
Parameters:
method mimeTypeToInsertCallBack [line 1255]
string mimeTypeToInsertCallBack(
string
$mime_type)
|
|
Returns name of text converter callback for given mime type.
Tags:
Parameters:
method moveObjectToStore [line 508]
string moveObjectToStore(
string
$name, string
$path, string
2)
|
|
Moves object to store. Takes the real name (~ file name on user's disk) as first argument, the path to the uploaded file as second argument. Returns the new name on disk which could be former name on edit action or newly build (uniqid + real name) on initial upload.
Tags:
Parameters:
method removeImageThumbnail [line 765]
bool removeImageThumbnail(
int
$object)
|
|
Remove thumbnail. Takes the object id as first argument. Returns bool.
Tags:
Parameters:
method removeObjectFromStore [line 552]
bool removeObjectFromStore(
int
$object)
|
|
Removes object form store. Takes the id of the object as first argument. Returns bool.
Tags:
Parameters:
method selectObject [line 184]
array selectObject(
int
$id)
|
|
Selects one object. Takes the object id as first argument. Returns array with object information.
Tags:
Parameters:
method selectObjects [line 266]
array selectObjects(
[array
$params = array()])
|
|
Method to select one or more objects. Takes key=>value array with select params as first argument. Returns array. List of supported params: - types, array, optional: Return only objects that belong to the given
generic types
- tags, array, optional: Returns objects with given tags
- timeframe, string, optional: Returns objects from given timeframe
- start, int, optional: row offset
- limit, int, optional: amount of rows to return
- order_marco, string, otpional: How to sort the result set.
Supported macros:
- DATE_MODIFIED: sorty by date modified
- DATE_ADDED: sort by date added
</ul>
Tags:
Parameters:
method sqlForGenericTypes [line 1163]
string sqlForGenericTypes(
string
$field, array
$types)
|
|
Generates sql fragment to select objects that belong to the different generic types. Takes the name of the mime type as first argument, the list of generic types that should be queried as second argument. Returns string.
Tags:
Parameters:
method testForUniqueFilename [line 993]
bool testForUniqueFilename(
string
$file_name, [integer
$id = null])
|
|
Tests given file for uniqueness. Takes the file name as first argument and the id as second argument as an option. The second argument is used to compare if the uploaded file name equals the former file name that is already on disk. When the file name is identical, we allow to replace this file. Returns boolean true if file name is unique.
Tags:
Parameters:
method updateObject [line 114]
int updateObject(
int
$id, array
$sqlData)
|
|
Updates object. Takes the object id as first argument, a field=>value array with the new object data as second argument. Returns amount of affected rows.
Tags:
Parameters:
method _flipTypes [line 1034]
array _flipTypes(
array
$types)
|
|
Flips keys and values in type array.
Tags:
Parameters:
|
|