Reference ManualsPhoto — A Photo object that contains a single photo.
Photo is part of the Gallery package.
class Photo {
public Album $album
private array $attrs
private bool $attrs_dirty
private Photo __construct ( Album &$album,
array $photo );
private bool apply_transforms ( string $file,
array $transforms,
&$transforms );
public mixed from_id ( Gallery &$gallery,
int $photo_id );
private mixed get_attr_name ( string $attr_name );
public string get_path ( int $type );
private bool make_writable ( string $path );
private void move ( int $offset );
public void move_down ( void );
public void move_up ( void );
public void save ( void );
public bool update_images ( string $file );
public mixed __get ( $attr_name );
public bool __isset ( $attr_name );
public void __set ( $attr_name,
$attr_value );
public void __unset ( $attr_name );
}
Photo
A Photo object that contains a single photo.
The photo metadata is stored in an SQL database. The minimal definition for the photos table is:
CREATE TABLE photos ( photo_id INTEGER PRIMARY KEY AUTOINCREMENT, album_id INTEGER, photo_filename VARCHAR(256), photo_rank INTEGER, photo_created INTEGER, photo_updates INTEGER )These columns are available as attributes of the Photo object, without the album_ prefix. Any extra columns in the database table are also exposed as attributes of the Album object through their column names. If the column names start with the album_ prefix then they will have this prefix stripped. The album_id is not exposed as an attibute. The Photo object already has a reference to the Album object.
public Album $album
A reference to the Album object that contains this Photo
Default value: empty string
private array $attrs
This holds the photo's metadata attributes
Default value: empty string
private bool $attrs_dirty
TRUE if the attributes have been changed
Default value: empty string
private Photo __construct ( Album &$album, array $photo );
Create a new Photo object.
The constructor is private since you should use the from_id() factory method.
private bool apply_transforms ( string $file,
array $transforms,
&$transforms );
Apply the stack of transforms to the image.
public mixed from_id ( Gallery &$gallery, int $photo_id );
Static factory method to create a Photo object for the photo with the given ID
private mixed get_attr_name ( string $attr_name );
Check the attribute name and prefix it with "album_" if need be.
Returns FALSE if the attribute does not exist.
public string get_path ( int $type );
Get the path of the photo relative to the gallery root
private bool make_writable ( string $path );
Ensure that $path can be written to.
Any missing directories will be created.
private void move ( int $offset );
Switch the Photo's rank with the Photo on $offset positions away in the same album
public void move_down ( void );
Move this Photo down in the rank order.
public void move_up ( void );
Move this Photo up in the rank order.
public void save ( void );
Save the Photo
public bool update_images ( string $file );
Regenerate the full size and thumbnail images.
If $file is set then this image will be used as a new original image. If $file is not set then the images will be regenerated from the existing original image in the gallery.
public mixed __get ( $attr_name );
Magic method for using the Photo's metadata attributes.Because Photos are stored in the database, you cannot add or remove attributes.See the PHP manual on overloading: http://nl.php.net/manual/en/language.oop5.overloading.php
public bool __isset ( $attr_name );
Magic method for using the Photo's metadata attributes.Because Photos are stored in the database, you cannot add or remove attributes.See the PHP manual on overloading: http://nl.php.net/manual/en/language.oop5.overloading.php
public void __set ( $attr_name,
$attr_value );
Magic method for using the Photo's metadata attributes.Because Photos are stored in the database, you cannot add or remove attributes.See the PHP manual on overloading: http://nl.php.net/manual/en/language.oop5.overloading.php
public void __unset ( $attr_name );
Magic method for using the Photo's metadata attributes.Because Photos are stored in the database, you cannot add or remove attributes.See the PHP manual on overloading: http://nl.php.net/manual/en/language.oop5.overloading.php