TextObject
extends Image
in package
Core class for handling "non-image" files
Text type files can be displayed in place of an image in themes
supports files of the following types: .txt .htm .html The contents of these files are "dumpped" into a SPAN sized to a 24x36 ratioed box based on your theme "image size" option. This has a class of "textobject" so it can be styled.
What this plugin really is for is to serve as a model of how a plugin can be made to handle file types that zenphoto does not handle natively.
Some key points to note:
- The naming convention for these plugins is class-«handler class».php.
- The statement setting the plugin_is_filter variable must be near the front of the file. This is important as it is the indicator to the Zenphoto plugin loader to load the script at the same point that other object modules are loaded.
- These objects are extension to the zenphoto "Image" class. This means they have all the properties of an image plus whatever you add. Of course you will need to override some of the image class functions to implement the functionality of your new class.
- There is one VERY IMPORTANT method that you must provide which is not part of the "Image" base class. That getContent() method. This method is called by template-functions.php in place of where it would normally put a URL to the image to show. This method must do everything needed to cause your image object to be viewable by the browser.
So, briefly, the first four lines of code below are the standard plugin interface to Admin. There is one small wrinkle you might notice--the code for 'plugin_description' includes a test which sets the variable $disable. As you might expect, there were some changes needed to zenphoto in order to get this concept to work. $disable is set to true if the revision of zenphoto that is attempting to load this plugin is lower than the one where the implementation first appeared. The interface variable 'plugin_disable' is set to this value telling Admin not to allow enabling of the plugin if the release level is too low.
The line that follows insures that the plugin will not load when it should be disabled--just in case.
Then there is a call on addPlginType(«file extension», «Object Name»); This function registers the plugin as the handler for files with the specified extension. If the plugin can handle more than one file extension, make a call to the registration function for each extension that it handles.
The rest is the object class for handling these files.
The code of the object instantiation function is mostly required. Plugin "images" follow the lead of videos in that if there is a real image file with the same name save the suffix, it will be considered the thumb image of the object. This image is fetched by the call on checkObjectsThumb(). There is also code in the getThumb() method to deal with this property.
Since text files have no natural height and width, we set them based on the image size option. This happens after the call PersistentObject(). The rest of the code there sets up the default title.
getThumb() is responsible for generating the thumbnail image for the object. As above, if there is a similar named real image, it will be used. Otherwise [for this object implementation] we will use a thumbnail image provided with the plugin. The particular form of the file name used when there is no thumb stand-in image allows zenphoto to choose an image in the plugin folder.
Tags
Table of Contents
Properties
- $album : mixed
- $albumlink : mixed
- $albumname : mixed
- $albumnamealbum : mixed
- $comments : mixed
- $displayname : mixed
- $encwebpath : mixed
- $exists : mixed
- $filemtime : mixed
- $filename : mixed
- $imagefolder : mixed
- $imagetype : mixed
- $loaded : mixed
- $localpath : mixed
- $manage_rights : mixed
- $manage_some_rights : mixed
- $metadata_refresh_behaviour : mixed
- $objectsThumb : mixed
- $sidecars : mixed
- $table : mixed
- $thumbdimensions : mixed
- $transient : mixed
- $view_rights : mixed
- $webpath : mixed
- $id : mixed
- $index : mixed
- $is_protected : mixed
- $is_public : mixed
- $sortorder : mixed
- $watermark : mixed
- $watermarkDefault : mixed
- $cache_by : mixed
- $commentcount : mixed
- $data : mixed
- $tempdata : mixed
- $unique_set : mixed
- $updates : mixed
- $use_cache : mixed
Methods
- __construct() : TextObject
- creates a textobject (image standin)
- __toString() : string
- "Magic" function to return a string identifying the object when it is treated as a string
- addComment() : object
- Adds comments to the album assumes data is coming straight from GET or POST
- calculateAspectRatio() : mixed
- Calculate the aspect ratio from width and height
- checkAccess() : mixed
- Checks if viewing of object is allowed by rights or protection status
- checkChanges() : bool
- By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.
- checkforGuest() : mixed
- Checks if guest is loggedin for the album
- checkForGuest() : mixed
- Checks if the item is password protected and if the password has been entered
- checkPublishDates() : bool
- Checks if the item is either expired or needs to be scheduled published
- checkScheduledPublishing() : int
- Checks if the item has expired or is in scheduled publishing
- clearCache() : mixed
- Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.
- clearObjectCache() : mixed
- Shortcut to clear the cache of the current object class only
- common_instantiate() : mixed
- Handles class common instantiation
- copy() : mixed
- Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.
- copyCacheFiles() : mixed
- Copies the cache files of the image to another cache folder
- countHit() : mixed
- counts visits to the object
- get() : mixed
- Get the value of a variable. If $current is false, return the value as of the last save of this object.
- getAlbum() : object
- Returns the album that holds this image
- getAlbumName() : string
- Retuns the folder name of the album that holds this image
- getCacheFiles() : array<string|int, mixed>
- Gets the cache files of the image
- getCity() : string
- Returns the city field of the image
- getCodeblock() : array<string|int, mixed>
- Returns the codeblocks as an serialized array
- getCommentCount() : int
- Returns the count of comments in the album. Ignores comments in moderation
- getComments() : array<string|int, mixed>
- Returns an array of comments for this album
- getCommentsAllowed() : bool
- Retuns true if comments are allowed
- getContent() : string
- Returns the content of the text file
- getCopyright() : string
- Returns the copyright field of the image
- getCopyrightNotice() : string|null
- Returns the content of the copyright field if set.
- getCopyrightRightsholder() : mixed
- Gets the general option "copyright_image_rightsholder" respectively "copyright_image_rightsholder_custom" If set to "none" the following fallbacks are tried.
- getCopyrightURL() : string
- Gets the image copyright URL
- getCountry() : string
- Returns the country field of the image
- getCredit() : string
- Returns the credit field of the image
- getCustomData() : string
- returns the custom data field
- getCustomImage() : string
- Get a custom sized version of this image based on the parameters.
- getCustomSizedImageMaxSpace() : string
- Returns a link to a un-cropped custom sized version of the current image within the given height and width dimensions.
- getData() : array<string|int, mixed>
- returns the database record of the object
- getDateTime() : int
- Returns the unformatted date
- getDesc() : string
- Returns the description
- getExpireDate() : string
- Returns the expired date if available,
- getFileName() : string
- Returns the image filename
- getFilesize() : int|false
- Returns the filesize in bytes of the full image
- getFullImage() : string
- Returns a path to the original image in the original folder.
- getFullImageURL() : mixed
- returns URL to the original image
- getGeodata() : array<string|int, mixed>
- If there is valid GPS data returns key value array with "long" and "lat" keys otherwise an empty array
- getHeight() : int
- Returns the height of the image
- getHitcounter() : int
- Returns the hitcount
- getID() : string
- Returns the id
- getImageFootprint() : string
- Returns the disk size of the image
- getIndex() : int
- Get the index of this image in the album, taking sorting into account.
- getIPTCData() : array<string|int, mixed>
- Parses IPTC meta data of an image and returns a preformatted array with the field names as indexes.
- getLastChange() : string
- Returns the last change user
- getLastChangeUser() : string
- Returns the last change user
- getLevel() : int
- Gets the level based on the sort order if the theme object is hierachical. Otherwise returns 1 (top level)
- getLink() : string
- Returns a path urlencoded image page link for the image
- getLocation() : string
- Returns the location field of the image
- getMaxSpaceContainer() : mixed
- Called by ***MaxSpace functions to compute the parameters to be passed to xxCustomyyy functions.
- getMetaData() : array<string|int, mixed>
- Returns an array of EXIF data
- getName() : string
- Returns the image filename
- getNextImage() : object
- Returns the next Image.
- getOrientation() : bool|string
- Returns 'is_square', 'is_landscape', 'is_portrait' if the original image's widht and height match.
- getOwner() : string
- Gets the owner of the image
- getParentID() : string
- Returns the partent id
- getPassword() : null
- Gets the password if set
- getPasswordHint() : string
- Returns the password hint
- getPrevImage() : object
- Return the previous Image
- getPublishDate() : string
- Returns the publish date
- getShow() : bool
- Returns true published
- getSizeCustomImage() : array<string|int, mixed>
- Returns an array with the height & width
- getSizeDefaultImage() : array<string|int, mixed>
- Returns an array [width, height] of the default-sized image.
- getSizeDefaultThumb() : array<string|int, mixed>
- Gets the width and height of a default thumb for the <img> tag height/width
- getSizedImage() : string
- (non-PHPdoc)
- getSortOrder() : string
- Returns the sort order
- getState() : string
- Returns the state field of the image
- getTags() : string
- Returns the tag data
- getThumb() : string
- returns a link to the thumbnail for the text file.
- getThumbCropping() : mixed
- Returns an array of cropping parameters. Used as a "helper" function for various inherited getThumb() methods
- getThumbDimensions() : array<string|int, mixed>
- Returns an array with widht and height the sidecar thumb image
- getThumbHeight() : int
- Returns the height of the image. Here just the same as getHeight().
- getThumbImageFile() : s
- Returns the image file name for the thumbnail image.
- getThumbWidth() : int
- Returns the width of the thumb. Here just the same as getWidth().
- getTitle() : string
- Returns the title
- getUser() : string
- Returns the guest user
- getWatermark() : string
- Returns the custom watermark name
- getWidth() : int
- Returns the width of the image
- getWMUse() : bool
- Returns the custom watermark usage
- hasExpiration() : bool
- Returns true if the item will be automatically unpublished by a not yet reached future expire date
- hasExpired() : bool
- Returns true if the items has been unpublished after reaching the set expire date.
- hasExpireDate() : bool
- Returns true if the item has a proper expire date set no matter if it has expired already or will expire in the future
- hasFutureDate() : string
- Returns the future date (publishdate for gallery, date for Zenpage items) if set to the future only
- hasInactiveExpiration() : bool
- Returns true if a future expiredate is set but the item is unpublished
- hasInactivePublishSchedule() : bool
- Returns true if the item has a future date but is not published
- hasMetaData() : bool
- Returns true if the image has any meta data
- hasPublishSchedule() : bool
- Returns true if the item will be automatically published by a future date set
- hasTag() : bool
- Checks if an object has a tag assigned.
- instantiate() : bool
- }
- isImageClass() : bool
- Returns true if the object is a zenphoto 'image'
- isLandscape() : bool
- Returns true if the image has landscape orientation
- isMyItem() : mixed
- Checks basic access rights of an object
- isPhoto() : bool
- Returns true if the image is a "photo"
- isPortrait() : bool
- Returns true if the image has portrait orientation
- isProtected() : bool
- Checks if the item is password protected. Checks if the password has been entered *
- isProtectedByParent() : bool
- Check if the item is not protected itself but protection is inherited by a parent. Checks if the password has been entered.
- isPublic() : bool
- Returns true if this object is published and does not inherit any unpublish status by a parent
- isPublished() : bool
- Returns true if the item itself is published
- isSquare() : bool
- Returns true if the image is a square
- isUnpublishedByParent() : bool
- Returns true if itself published but unpublished status is inheretited by a parent
- isVideo() : bool
- Returns true if the image is an "video" file
- isVisible() : bool
- Checks if the current item is visible (= listed) to the current visitor via rights, publish status or protection status
- move() : mixed
- Change one or more values of the unique set assigned to this record.
- moveCacheFiles() : bool
- Moves the cache files of the image to another cache folder
- newImage() : object
- Returns a new "image" object based on the file extension
- remove() : bool
- Deletes object from the database
- removeCacheFiles() : mixed
- Removes cached files
- rename() : bool
- Renames an image to a new filename, keeping it in the same album. Convenience for move($image->album, $newfilename).
- renameCacheFiles() : bool
- Renames the cache files of the image Alias of moveCacheFiles()
- save() : mixed
- Save the updates made to this object since the last update. Returns true if successful, false if not.
- set() : mixed
- Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.
- setCity() : mixed
- Stores the city field of the image
- setCodeblock() : mixed
- set the codeblocks as an serialized array
- setCommentsAllowed() : mixed
- Sets the comments allowed flag
- setCopyright() : mixed
- Stores the text for the copyright field of the image
- setCountry() : mixed
- Stores the country field of the image
- setCredit() : mixed
- Stores the credit field of the image
- setCustomData() : mixed
- Sets the custom data field
- setDateTime() : mixed
- Stores the date
- setDesc() : mixed
- Stores the description
- setExpireDate() : mixed
- sets the expire date
- setLastChange() : mixed
- stores the current date in the format 'Y-m-d H:i:s' as the last change date
- setLastchangeUser() : mixed
- stores the last change user
- setLocation() : mixed
- Stores the location field of the image
- setOwner() : mixed
- setParentID() : mixed
- Sets the ParentID field
- setPassword() : mixed
- Sets the encrypted password
- setPasswordHint() : mixed
- Sets the password hint
- setPublishDate() : mixed
- sets the publish date
- setPublished() : mixed
- Stores the published value
- setShow() : mixed
- Stores the published value
- setSortOrder() : mixed
- Stores the sort order
- setState() : mixed
- Stores the state field of the image
- setTags() : mixed
- Stores tag information
- setTitle() : mixed
- Stores the title
- setUpdatedDateAlbum() : mixed
- Sets the current date to the images'album and all of its parent albums recursively
- setUser() : mixed
- Sets the guest user
- setWatermark() : mixed
- Set custom watermark
- setWMUse() : mixed
- Sets the custom watermark usage
- updateDimensions() : mixed
- (non-PHPdoc)
- updateMetaData() : mixed
- Parses Exif/IPTC data
- classSetup() : bool
- generic "image" class setup code Returns true if valid image.
- fileChanged() : bool
- Returns true if the file has changed since last time we looked
- setDefaults() : mixed
- Sets default values for new objects using the set() method.
- addToCache() : mixed
- add the entry to the cache
- getFromCache() : mixed
- check the cache for presence of the entry and return it if found
- getIPTCTag() : string
- Fetches a single tag from IPTC data
- getIPTCTagArray() : array<string|int, mixed>
- Fetches the IPTC array for a single tag.
- load() : false
- Load the data array from the database, using the unique id set to get the unique record.
- prepIPTCString() : string
- Returns the IPTC data converted into UTF8
Properties
$album
public
mixed
$album
$albumlink
public
mixed
$albumlink
$albumname
public
mixed
$albumname
$albumnamealbum
public
mixed
$albumnamealbum
$comments
public
mixed
$comments
= \NULL
$displayname
public
mixed
$displayname
$encwebpath
public
mixed
$encwebpath
= ''
$exists
public
mixed
$exists
= \false
$filemtime
public
mixed
$filemtime
$filename
public
mixed
$filename
$imagefolder
public
mixed
$imagefolder
$imagetype
public
mixed
$imagetype
= ''
$loaded
public
mixed
$loaded
= \false
$localpath
public
mixed
$localpath
$manage_rights
public
mixed
$manage_rights
= \ADMIN_RIGHTS
$manage_some_rights
public
mixed
$manage_some_rights
= \ADMIN_RIGHTS
$metadata_refresh_behaviour
public
mixed
$metadata_refresh_behaviour
= 'full-refresh'
$objectsThumb
public
mixed
$objectsThumb
= \NULL
$sidecars
public
mixed
$sidecars
= array()
$table
public
mixed
$table
$thumbdimensions
public
mixed
$thumbdimensions
= \null
$transient
public
mixed
$transient
$view_rights
public
mixed
$view_rights
= \VIEW_ALL_RIGHTS
$webpath
public
mixed
$webpath
$id
protected
mixed
$id
= 0
$index
protected
mixed
$index
$is_protected
protected
mixed
$is_protected
= \null
$is_public
protected
mixed
$is_public
= \null
$sortorder
protected
mixed
$sortorder
$watermark
protected
mixed
$watermark
= \NULL
$watermarkDefault
protected
mixed
$watermarkDefault
= \NULL
$cache_by
private
mixed
$cache_by
$commentcount
private
mixed
$commentcount
$data
private
mixed
$data
= \NULL
$tempdata
private
mixed
$tempdata
= \NULL
$unique_set
private
mixed
$unique_set
= \NULL
$updates
private
mixed
$updates
= \NULL
$use_cache
private
mixed
$use_cache
= \false
Methods
__construct()
creates a textobject (image standin)
public
__construct(object $album, string $filename[, mixed $quiet = false ]) : TextObject
Parameters
- $album : object
-
the owner album
- $filename : string
-
the filename of the text file
- $quiet : mixed = false
Return values
TextObject__toString()
"Magic" function to return a string identifying the object when it is treated as a string
public
__toString() : string
Return values
stringaddComment()
Adds comments to the album assumes data is coming straight from GET or POST
public
addComment(string $name, string $email, string $website, string $comment, string $code, string $code_ok, string $ip, bool $private, bool $anon, string $customdata, bool $dataconfirmation, string $p_textquiz_answer, string $p_mathquiz_answer) : object
Returns a comment object
Parameters
- $name : string
-
Comment author name
- $email : string
-
Comment author email
- $website : string
-
Comment author website
- $comment : string
-
body of the comment
- $code : string
-
CAPTCHA code entered
- $code_ok : string
-
CAPTCHA hash expected
- $ip : string
-
the IP address of the comment poster
- $private : bool
-
set to true if the comment is for the admin only
- $anon : bool
-
set to true if the poster wishes to remain anonymous
- $customdata : string
- $dataconfirmation : bool
-
true or false if data privacy confirmation was required
- $p_textquiz_answer : string
- $p_mathquiz_answer : string
Return values
objectcalculateAspectRatio()
Calculate the aspect ratio from width and height
public
static calculateAspectRatio([int $width = null ][, int $height = null ][, string $separator = ':' ]) : mixed
Parameters
- $width : int = null
- $height : int = null
- $separator : string = ':'
-
Separator for the aspect ratio. Defaul ":"
Tags
checkAccess()
Checks if viewing of object is allowed by rights or protection status
public
checkAccess([string &$hint = NULL ][, string &$show = NULL ]) : mixed
Parameters
- $hint : string = NULL
- $show : string = NULL
checkChanges()
By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.
public
checkChanges([bool $update = true ]) : bool
This checks that and internally updates the $updates
property with the actual changes obky so you optionally can skip unnecessary object saves.
Standard object fields lastchange
and lastchangeuser
are exclude because lastchange
always changes and both make no sense
if there is no actual content change at all.
This can be used before calling the save() method or enabled within the save() method optionally
Parameters
- $update : bool = true
-
True (default) to also update the $updates property with changes found or clear it. False to only check for changes.
Tags
Return values
boolcheckforGuest()
Checks if guest is loggedin for the album
public
checkforGuest([unknown_type &$hint = NULL ][, unknown_type &$show = NULL ]) : mixed
Parameters
- $hint : unknown_type = NULL
- $show : unknown_type = NULL
checkForGuest()
Checks if the item is password protected and if the password has been entered
public
checkForGuest([ &$hint = NULL ][, &$show = NULL ]) : mixed
Parameters
checkPublishDates()
Checks if the item is either expired or needs to be scheduled published
public
checkPublishDates() : bool
Unpublishes the item if expired (saves to db) or scheduled (temporary) and returns false if expired or scheduled.
Return values
boolcheckScheduledPublishing()
Checks if the item has expired or is in scheduled publishing
public
static checkScheduledPublishing(array<string|int, mixed> $row) : int
Returns 1 if expired, 2 if in scheduled future publishing
Parameters
- $row : array<string|int, mixed>
-
database row of the object
Tags
Return values
intclearCache()
Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.
public
static clearCache([mixed $class = null ]) : mixed
Note: You normally never need to use this. But on certain occasions it may be necessary to avoid memory issues if you loop through a lot of object creations.
Parameters
- $class : mixed = null
Tags
clearObjectCache()
Shortcut to clear the cache of the current object class only
public
clearObjectCache() : mixed
Tags
common_instantiate()
Handles class common instantiation
public
common_instantiate( $album, $filename[, mixed $quiet = false ]) : mixed
Parameters
copy()
Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.
public
copy(mixed $new_unique_set) : mixed
A call to copy is instant, it does not require a save() following it.
Parameters
- $new_unique_set : mixed
copyCacheFiles()
Copies the cache files of the image to another cache folder
public
copyCacheFiles(object $newalbum) : mixed
Parameters
- $newalbum : object
-
Target album object
Tags
countHit()
counts visits to the object
public
countHit() : mixed
get()
Get the value of a variable. If $current is false, return the value as of the last save of this object.
public
get(mixed $var[, mixed $current = true ]) : mixed
Parameters
- $var : mixed
- $current : mixed = true
getAlbum()
Returns the album that holds this image
public
getAlbum() : object
Return values
objectgetAlbumName()
Retuns the folder name of the album that holds this image
public
getAlbumName() : string
Return values
stringgetCacheFiles()
Gets the cache files of the image
public
getCacheFiles() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getCity()
Returns the city field of the image
public
getCity([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetCodeblock()
Returns the codeblocks as an serialized array
public
getCodeblock() : array<string|int, mixed>
Return values
array<string|int, mixed>getCommentCount()
Returns the count of comments in the album. Ignores comments in moderation
public
getCommentCount() : int
Return values
intgetComments()
Returns an array of comments for this album
public
getComments([bool $moderated = false ][, bool $private = false ][, bool $desc = false ]) : array<string|int, mixed>
Parameters
- $moderated : bool = false
-
if false, ignores comments marked for moderation
- $private : bool = false
-
if false ignores private comments
- $desc : bool = false
-
set to true for descending order
Return values
array<string|int, mixed>getCommentsAllowed()
Retuns true if comments are allowed
public
getCommentsAllowed() : bool
Return values
boolgetContent()
Returns the content of the text file
public
getContent([int $w = NULL ][, int $h = NULL ]) : string
Parameters
- $w : int = NULL
-
optional width
- $h : int = NULL
-
optional height
Return values
stringgetCopyright()
Returns the copyright field of the image
public
getCopyright([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetCopyrightNotice()
Returns the content of the copyright field if set.
public
getCopyrightNotice([string $locale = null ]) : string|null
If not it tries the following fallbacks:
- IPTCCopyright field
- EXIFCopyright field
- "copyright_image_notice" option
- Owner
Parameters
- $locale : string = null
Tags
Return values
string|nullgetCopyrightRightsholder()
Gets the general option "copyright_image_rightsholder" respectively "copyright_image_rightsholder_custom" If set to "none" the following fallbacks are tried.
public
getCopyrightRightsholder() : mixed
- EXIFArtist
- VideoArtist (for multimedia "images") – IPTCByLine
- the owner (fullname if available)
Tags
getCopyrightURL()
Gets the image copyright URL
public
getCopyrightURL() : string
Tags
Return values
stringgetCountry()
Returns the country field of the image
public
getCountry([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetCredit()
Returns the credit field of the image
public
getCredit([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetCustomData()
returns the custom data field
public
getCustomData([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetCustomImage()
Get a custom sized version of this image based on the parameters.
public
getCustomImage(int $size, int $width, int $height, int $cropw, int $croph, int $cropx, int $cropy[, bool $thumbStandin = false ][, bool $effects = NULL ]) : string
Parameters
- $size : int
-
size
- $width : int
-
width
- $height : int
-
height
- $cropw : int
-
crop width
- $croph : int
-
crop height
- $cropx : int
-
crop x axis
- $cropy : int
-
crop y axis
- $thumbStandin : bool = false
-
set to true to treat as thumbnail
- $effects : bool = NULL
-
ignored
Return values
stringgetCustomSizedImageMaxSpace()
Returns a link to a un-cropped custom sized version of the current image within the given height and width dimensions.
public
getCustomSizedImageMaxSpace(int $width, int $height[, bool $thumb = false ]) : string
Use for sized images.
Parameters
- $width : int
-
width
- $height : int
-
height
- $thumb : bool = false
Tags
Return values
stringgetData()
returns the database record of the object
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed>getDateTime()
Returns the unformatted date
public
getDateTime() : int
Return values
intgetDesc()
Returns the description
public
getDesc([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetExpireDate()
Returns the expired date if available,
public
getExpireDate() : string
Tags
Return values
stringgetFileName()
Returns the image filename
public
getFileName() : string
Tags
Return values
stringgetFilesize()
Returns the filesize in bytes of the full image
public
getFilesize() : int|false
Tags
Return values
int|falsegetFullImage()
Returns a path to the original image in the original folder.
public
getFullImage([string $path = WEBPATH ]) : string
Parameters
- $path : string = WEBPATH
-
the "path" to the image. Defaults to the simple WEBPATH
Return values
stringgetFullImageURL()
returns URL to the original image
public
getFullImageURL([string $path = WEBPATH ]) : mixed
Parameters
- $path : string = WEBPATH
-
the "path" to the image. Defaults to the simple WEBPATH
getGeodata()
If there is valid GPS data returns key value array with "long" and "lat" keys otherwise an empty array
public
getGeodata() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getHeight()
Returns the height of the image
public
getHeight() : int
Return values
intgetHitcounter()
Returns the hitcount
public
getHitcounter() : int
Return values
intgetID()
Returns the id
public
getID() : string
Return values
stringgetImageFootprint()
Returns the disk size of the image
public
getImageFootprint() : string
Return values
stringgetIndex()
Get the index of this image in the album, taking sorting into account.
public
getIndex([bool $use_realalbum = false ]) : int
Parameters
- $use_realalbum : bool = false
-
If the image is wihtin a dynamic album this is the index within it, set to true to get the index of the actual physical album the image belongs
Return values
intgetIPTCData()
Parses IPTC meta data of an image and returns a preformatted array with the field names as indexes.
public
getIPTCData() : array<string|int, mixed>
Meta data fields not enabled are already excluded
All Field data is converted to strings for later db storage "Keywords" are also stored as original array as "tags" separately
Tags
Return values
array<string|int, mixed>getLastChange()
Returns the last change user
public
getLastChange() : string
Return values
stringgetLastChangeUser()
Returns the last change user
public
getLastChangeUser() : string
Tags
Return values
stringgetLevel()
Gets the level based on the sort order if the theme object is hierachical. Otherwise returns 1 (top level)
public
getLevel() : int
Tags
Return values
intgetLink()
Returns a path urlencoded image page link for the image
public
getLink([string $path = null ]) : string
Parameters
- $path : string = null
-
Default null, optionally pass a path constant like WEBPATH or FULLWEBPATH
Return values
stringgetLocation()
Returns the location field of the image
public
getLocation([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetMaxSpaceContainer()
Called by ***MaxSpace functions to compute the parameters to be passed to xxCustomyyy functions.
public
getMaxSpaceContainer(int &$width, int &$height[, bool $thumb = false ]) : mixed
Parameters
- $width : int
-
maxspace width by reference
- $height : int
-
maxspace height by reference
- $thumb : bool = false
-
true if for a thumbnail
Tags
getMetaData()
Returns an array of EXIF data
public
getMetaData([string $displayonly = true ][, bool $hide_empty = true ]) : array<string|int, mixed>
Parameters
- $displayonly : string = true
-
set to true to return only the items selected for display (default true)
- $hide_empty : bool = true
-
Hide empty meta data fields (default true)
Tags
Return values
array<string|int, mixed>getName()
Returns the image filename
public
getName() : string
Tags
Return values
stringgetNextImage()
Returns the next Image.
public
getNextImage() : object
Return values
objectgetOrientation()
Returns 'is_square', 'is_landscape', 'is_portrait' if the original image's widht and height match.
public
getOrientation([string $type = 'image' ]) : bool|string
Parameters
- $type : string = 'image'
-
'image' or 'thumb' - the latter may be different on non image "image items"
Tags
Return values
bool|stringgetOwner()
Gets the owner of the image
public
getOwner([bool $fullname = false ]) : string
Parameters
- $fullname : bool = false
-
Set to true to get the full name (if the owner is a vaild user of the site and has the full name defined)
Return values
stringgetParentID()
Returns the partent id
public
getParentID() : string
Return values
stringgetPassword()
Gets the password if set
public
getPassword() : null
Placeholder for all child classes. Needs to be properly overriden there if password functionality is available
Tags
Return values
nullgetPasswordHint()
Returns the password hint
public
getPasswordHint([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetPrevImage()
Return the previous Image
public
getPrevImage() : object
Return values
objectgetPublishDate()
Returns the publish date
public
getPublishDate() : string
Return values
stringgetShow()
Returns true published
public
getShow() : bool
Tags
Return values
boolgetSizeCustomImage()
Returns an array with the height & width
public
getSizeCustomImage([int $size = null ][, int $width = NULL ][, int $height = NULL ][, int $cw = NULL ][, int $ch = NULL ][, int $cx = NULL ][, int $cy = NULL ][, string $type = 'image' ]) : array<string|int, mixed>
Parameters
- $size : int = null
-
size
- $width : int = NULL
-
width
- $height : int = NULL
-
height
- $cw : int = NULL
-
crop width
- $ch : int = NULL
-
crop height
- $cx : int = NULL
-
crop x axis
- $cy : int = NULL
-
crop y axis
- $type : string = 'image'
-
"image" (sizedimage) (default), "thumb" (thumbnail) required for using option settings for uncropped images
Tags
Return values
array<string|int, mixed>getSizeDefaultImage()
Returns an array [width, height] of the default-sized image.
public
getSizeDefaultImage([int $size = NULL ]) : array<string|int, mixed>
Parameters
- $size : int = NULL
-
override the 'image_zize' option
Tags
Return values
array<string|int, mixed>getSizeDefaultThumb()
Gets the width and height of a default thumb for the <img> tag height/width
public
getSizeDefaultThumb() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getSizedImage()
(non-PHPdoc)
public
getSizedImage(mixed $size) : string
Parameters
- $size : mixed
-
how big an image is wanted
Tags
Return values
stringgetSortOrder()
Returns the sort order
public
getSortOrder() : string
Return values
stringgetState()
Returns the state field of the image
public
getState([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetTags()
Returns the tag data
public
getTags() : string
Return values
stringgetThumb()
returns a link to the thumbnail for the text file.
public
getThumb([string $type = 'image' ]) : string
Parameters
- $type : string = 'image'
-
'image' or 'album'
Return values
stringgetThumbCropping()
Returns an array of cropping parameters. Used as a "helper" function for various inherited getThumb() methods
public
getThumbCropping(mixed $ts, mixed $sw, mixed $sh) : mixed
Parameters
- $ts : mixed
- $sw : mixed
- $sh : mixed
getThumbDimensions()
Returns an array with widht and height the sidecar thumb image
public
getThumbDimensions() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getThumbHeight()
Returns the height of the image. Here just the same as getHeight().
public
getThumbHeight() : int
Tags
Return values
intgetThumbImageFile()
Returns the image file name for the thumbnail image.
public
getThumbImageFile([string $path = NULL ]) : s
Parameters
- $path : string = NULL
-
override path
Return values
sgetThumbWidth()
Returns the width of the thumb. Here just the same as getWidth().
public
getThumbWidth() : int
Tags
Return values
intgetTitle()
Returns the title
public
getTitle([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetUser()
Returns the guest user
public
getUser() : string
Return values
stringgetWatermark()
Returns the custom watermark name
public
getWatermark() : string
Return values
stringgetWidth()
Returns the width of the image
public
getWidth() : int
Return values
intgetWMUse()
Returns the custom watermark usage
public
getWMUse() : bool
Return values
boolhasExpiration()
Returns true if the item will be automatically unpublished by a not yet reached future expire date
public
hasExpiration() : bool
Tags
Return values
boolhasExpired()
Returns true if the items has been unpublished after reaching the set expire date.
public
hasExpired() : bool
Tags
Return values
boolhasExpireDate()
Returns true if the item has a proper expire date set no matter if it has expired already or will expire in the future
public
hasExpireDate() : bool
Tags
Return values
boolhasFutureDate()
Returns the future date (publishdate for gallery, date for Zenpage items) if set to the future only
public
hasFutureDate() : string
Tags
Return values
string —| null
hasInactiveExpiration()
Returns true if a future expiredate is set but the item is unpublished
public
hasInactiveExpiration() : bool
Tags
Return values
boolhasInactivePublishSchedule()
Returns true if the item has a future date but is not published
public
hasInactivePublishSchedule() : bool
Tags
Return values
boolhasMetaData()
Returns true if the image has any meta data
public
hasMetaData() : bool
Tags
Return values
boolhasPublishSchedule()
Returns true if the item will be automatically published by a future date set
public
hasPublishSchedule() : bool
Tags
Return values
boolhasTag()
Checks if an object has a tag assigned.
public
hasTag(string $checktag) : bool
Parameters
- $checktag : string
-
tag to check for
Return values
boolinstantiate()
}
public
instantiate( $tablename, $unique_set[, $cache_by = NULL ][, $use_cache = true ][, $is_transient = false ][, $allowCreate = true ]) : bool
Prime instantiator for Zenphoto objects
Parameters
- $tablename :
-
The name of the database table
- $unique_set :
-
An array of unique fields
- $cache_by : = NULL
- $use_cache : = true
- $is_transient : = false
-
Set true to prevent database insertion
- $allowCreate : = true
-
Set true to allow a new object to be made.
Return values
bool —will be true if the unique_set does not already exist
isImageClass()
Returns true if the object is a zenphoto 'image'
public
static isImageClass([object $image = NULL ]) : bool
Parameters
- $image : object = NULL
Tags
Return values
boolisLandscape()
Returns true if the image has landscape orientation
public
isLandscape([string $type = 'image' ]) : bool
Parameters
- $type : string = 'image'
-
'image' or 'thumb' - the latter may be different on non image "image items"
Tags
Return values
boolisMyItem()
Checks basic access rights of an object
public
isMyItem([bit $action = LIST_RIGHTS ]) : mixed
Parameters
- $action : bit = LIST_RIGHTS
-
User rights level, default LIST_RIGHTS
isPhoto()
Returns true if the image is a "photo"
public
isPhoto() : bool
Tags
Return values
boolisPortrait()
Returns true if the image has portrait orientation
public
isPortrait([string $type = 'image' ]) : bool
Parameters
- $type : string = 'image'
-
'image' or 'thumb' - the latter may be different on non image "image items"
Tags
Return values
boolisProtected()
Checks if the item is password protected. Checks if the password has been entered *
public
isProtected() : bool
Tags
Return values
boolisProtectedByParent()
Check if the item is not protected itself but protection is inherited by a parent. Checks if the password has been entered.
public
isProtectedByParent() : bool
Tags
Return values
boolisPublic()
Returns true if this object is published and does not inherit any unpublish status by a parent
public
isPublic() : bool
Child classes with any hierachic structure need to override and extend this method to cover inheritance.
Tags
Return values
boolisPublished()
Returns true if the item itself is published
public
isPublished([bool $use_dbvalue = false ]) : bool
Parameters
- $use_dbvalue : bool = false
-
Set to true to use the actual db value stored and not the possibly temporary modified value (e.g. if in scheduled publishing or expiration)
Tags
Return values
boolisSquare()
Returns true if the image is a square
public
isSquare([string $type = 'image' ]) : bool
Parameters
- $type : string = 'image'
-
'image' or 'thumb' - the latter may be different on non image "image items"
Tags
Return values
boolisUnpublishedByParent()
Returns true if itself published but unpublished status is inheretited by a parent
public
isUnpublishedByParent() : bool
Tags
Return values
boolisVideo()
Returns true if the image is an "video" file
public
isVideo() : bool
Tags
Return values
boolisVisible()
Checks if the current item is visible (= listed) to the current visitor via rights, publish status or protection status
public
isVisible([bit $action = LIST_RIGHTS ]) : bool
Convenience wrapper for various methods.
Parameters
- $action : bit = LIST_RIGHTS
-
User rights level, default LIST_RIGHTS
Tags
Return values
boolmove()
Change one or more values of the unique set assigned to this record.
public
move(mixed $new_unique_set) : mixed
Checks if the record already exists first, if so returns false. If successful returns true and changes $this->unique_set A call to move is instant, it does not require a save() following it.
Parameters
- $new_unique_set : mixed
moveCacheFiles()
Moves the cache files of the image to another cache folder
public
moveCacheFiles(object $newalbum, string $newfilename) : bool
Parameters
- $newalbum : object
-
Target album object
- $newfilename : string
-
Album folder name of the cache folder (album/subalbum/…)
Tags
Return values
boolnewImage()
Returns a new "image" object based on the file extension
public
static newImage(object $album, string $filename[, bool $quiet = false ]) : object
Parameters
- $album : object
-
the owner album
- $filename : string
-
the filename
- $quiet : bool = false
-
set true to supress error messages (used by loadimage)
Tags
Return values
objectremove()
Deletes object from the database
public
remove() : bool
Return values
boolremoveCacheFiles()
Removes cached files
public
removeCacheFiles() : mixed
Tags
rename()
Renames an image to a new filename, keeping it in the same album. Convenience for move($image->album, $newfilename).
public
rename(string $newfilename) : bool
Returns true on success and false on failure.
Parameters
- $newfilename : string
-
the new file name of the image file.
Return values
boolrenameCacheFiles()
Renames the cache files of the image Alias of moveCacheFiles()
public
renameCacheFiles(mixed $newfilename) : bool
Parameters
- $newfilename : mixed
Tags
Return values
boolsave()
Save the updates made to this object since the last update. Returns true if successful, false if not.
public
save([bool $checkupdates = false ]) : mixed
Parameters
- $checkupdates : bool = false
-
Default false. If true the internal $updates property is checked for actual changes so unnecessary saving is skipped. Applies to already existing objects only.
set()
Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.
public
set(mixed $var, mixed $value) : mixed
If the requested variable is not in the database, sets it in temp storage, which won't be persisted to the database.
Parameters
- $var : mixed
- $value : mixed
setCity()
Stores the city field of the image
public
setCity(string $city) : mixed
Parameters
- $city : string
-
text for the city
setCodeblock()
set the codeblocks as an serialized array
public
setCodeblock(mixed $cb) : mixed
Parameters
- $cb : mixed
setCommentsAllowed()
Sets the comments allowed flag
public
setCommentsAllowed(bool $commentson) : mixed
Parameters
- $commentson : bool
-
true if they are allowed
setCopyright()
Stores the text for the copyright field of the image
public
setCopyright(string $copyright) : mixed
Parameters
- $copyright : string
-
text for the copyright field
setCountry()
Stores the country field of the image
public
setCountry(string $country) : mixed
Parameters
- $country : string
-
text for the country filed
setCredit()
Stores the credit field of the image
public
setCredit(string $credit) : mixed
Parameters
- $credit : string
-
text for the credit field
setCustomData()
Sets the custom data field
public
setCustomData(string $val) : mixed
Parameters
- $val : string
-
the value to be put in custom_data
setDateTime()
Stores the date
public
setDateTime(string $datetime) : mixed
Parameters
- $datetime : string
-
formatted date
setDesc()
Stores the description
public
setDesc(string $desc) : mixed
Parameters
- $desc : string
-
description text
setExpireDate()
sets the expire date
public
setExpireDate(mixed $ed) : mixed
Parameters
- $ed : mixed
setLastChange()
stores the current date in the format 'Y-m-d H:i:s' as the last change date
public
setLastChange() : mixed
setLastchangeUser()
stores the last change user
public
setLastchangeUser(mixed $a) : mixed
Parameters
- $a : mixed
Tags
setLocation()
Stores the location field of the image
public
setLocation(string $location) : mixed
Parameters
- $location : string
-
text for the location
setOwner()
public
setOwner(mixed $owner) : mixed
Parameters
- $owner : mixed
setParentID()
Sets the ParentID field
public
setParentID( $v) : mixed
Parameters
setPassword()
Sets the encrypted password
public
setPassword(string $pwd) : mixed
Parameters
- $pwd : string
-
the cleartext password
setPasswordHint()
Sets the password hint
public
setPasswordHint(string $hint) : mixed
Parameters
- $hint : string
-
the hint text
setPublishDate()
sets the publish date
public
setPublishDate(mixed $ed) : mixed
Parameters
- $ed : mixed
setPublished()
Stores the published value
public
setPublished(bool $published) : mixed
Parameters
- $published : bool
-
True if the item is published
Tags
setShow()
Stores the published value
public
setShow(bool $show) : mixed
Parameters
- $show : bool
-
True if the album is published
Tags
setSortOrder()
Stores the sort order
public
setSortOrder(string $sortorder) : mixed
Parameters
- $sortorder : string
-
image sort order
setState()
Stores the state field of the image
public
setState(string $state) : mixed
Parameters
- $state : string
-
text for the state
setTags()
Stores tag information
public
setTags(string $tags) : mixed
Parameters
- $tags : string
-
the tag list
setTitle()
Stores the title
public
setTitle(string $title) : mixed
Parameters
- $title : string
-
the title
setUpdatedDateAlbum()
Sets the current date to the images'album and all of its parent albums recursively
public
setUpdatedDateAlbum() : mixed
Tags
setUser()
Sets the guest user
public
setUser(string $user) : mixed
Parameters
- $user : string
setWatermark()
Set custom watermark
public
setWatermark(string $wm) : mixed
Parameters
- $wm : string
setWMUse()
Sets the custom watermark usage
public
setWMUse( $use) : mixed
Parameters
updateDimensions()
(non-PHPdoc)
public
updateDimensions() : mixed
Tags
updateMetaData()
Parses Exif/IPTC data
public
updateMetaData() : mixed
classSetup()
generic "image" class setup code Returns true if valid image.
protected
classSetup(object &$album, string $filename) : bool
Parameters
- $album : object
-
the images' album
- $filename : string
-
of the image
Return values
boolfileChanged()
Returns true if the file has changed since last time we looked
protected
fileChanged() : bool
Return values
boolsetDefaults()
Sets default values for new objects using the set() method.
protected
setDefaults() : mixed
Should do nothing in the base class; subclasses should override.
addToCache()
add the entry to the cache
private
addToCache( $entry) : mixed
Parameters
getFromCache()
check the cache for presence of the entry and return it if found
private
getFromCache() : mixed
getIPTCTag()
Fetches a single tag from IPTC data
private
getIPTCTag(string $tag, mixed $iptc) : string
Parameters
- $tag : string
-
the metadata tag sought
- $iptc : mixed
Return values
stringgetIPTCTagArray()
Fetches the IPTC array for a single tag.
private
getIPTCTagArray(string $tag, mixed $iptc) : array<string|int, mixed>
Parameters
- $tag : string
-
the metadata tag sought
- $iptc : mixed
Return values
array<string|int, mixed>load()
Load the data array from the database, using the unique id set to get the unique record.
private
load(bool $allowCreate) : false
Parameters
- $allowCreate : bool
-
set to true to enable new object creation.
Return values
false —if the record already exists, true if a new record was created.
prepIPTCString()
Returns the IPTC data converted into UTF8
private
prepIPTCString(string $iptcstring, string $characterset) : string
Parameters
- $iptcstring : string
-
the IPTC data
- $characterset : string
-
the internal encoding of the data