SourceForge.net LogoPHPGallue
[ class tree: libgallue ] [ index: libgallue ] [ all elements ]

Class: GALImages

Source Location: /libgallue/image.inc.php

Class Overview

GALTable
   |
   --GALGallueTable
      |
      --GALImages

Manage images and handle database communication.


Methods


Inherited Variables

Inherited Methods

Class: GALGallueTable

GALGallueTable::__construct()
Initializes $glb object variable.
GALGallueTable::search()
SQL expression that searches for items containing $term.
GALGallueTable::visible()
SQL expression that is TRUE only for items visible to the user currently logged in.
GALGallueTable::writeable()
SQL expression that is TRUE only for items writeable by the user currently logged in.

Class: GALTable

GALTable::__construct()
Initializes this table.
GALTable::buildResult()
Implements the GALResultFactory interface.
GALTable::compareExpression()
Factory for GALExpressionCompare objects.
GALTable::containsKeyFields()
Checks if the specified fields contains a field that belongs to the primary key.
GALTable::count()
Count rows that match the given GALExpression.
GALTable::countFields()
Returns the number of fields contained in a result.
GALTable::delete()
Deletes the row identified by $key from the database.
GALTable::extendedCount()
Template for complex count queries.
GALTable::extendedLoad()
Template for complex queries.
GALTable::fullKey()
Checks if the specified fields in $keys are the full primary key.
GALTable::getFields()
Returns all fields contained in this result.
GALTable::getFlags()
Gets the flags of the given field.
GALTable::getIfRegistered()
Return the row with the submitted primary key values, if it has been registered before.
GALTable::getLength()
Gets the length of the given field.
GALTable::getName()
Returns this table's name.
GALTable::getParent()
Returns a reference to this table.
GALTable::getPrimaryKey()
Returns the primary key of this table.
GALTable::getResultFactory()
Returns the factory to construct results.
GALTable::getRowFactory()
Returns the factory to construct rows.
GALTable::getTable()
Gets the name of the table the given field is contained in.
GALTable::getType()
Gets the type of the given field.
GALTable::insert()
Inserts a row into this table.
GALTable::insertMultiple()
Inserts multiple rows into the database.
GALTable::isField()
Checks if the given field is contained in a result.
GALTable::load()
Load rows that match the given GALExpression.
GALTable::rawCount()
Counts rows from this table.
GALTable::rawLoad()
Loads rows from this table.
GALTable::register()
Registers the specified row or returns an already registered row.
GALTable::registered()
Checks if the specified row is already registered.
GALTable::row()
Fetches a row matching the given key from the database.
GALTable::setRegistered()
Set the entry in $rows specified by &$keys to the specified value.
GALTable::stripKeys()
Removes all fields from the submitted data which belong to the primary key.
GALTable::unregister()
Removes a registered row.
GALTable::updateRow()
Sets the fields of the specified row to the specified values.
GALTable::validFields()
Checks if all the field names submitted in $fields are valid.
GALTable::__destruct()
Destructs all rows stored in $rows.

Class Details

[line 39]
Manage images and handle database communication.

Only one instance of this class should exist for one database connection, i.e. one instance of GALGallery. This is assured inside __construct(). Most work is done by inherited methods from GALTable.




[ Top ]


Class Methods


constructor __construct [line 53]

GALImages __construct( GALGallery $glb)

Initialize using GALGallery object.

This constructor shouldn't be called by a library user, the representations for the used tables are automatically created by the GALGallery object.

Check if an instance of Images already exists in the specified GALGallery. If this is the case, throw an GAL_EImage. If not, read necessary information for further initialization from $glb.




Tags:



Overrides GALGallueTable::__construct() (Initializes $glb object variable.)

Parameters:

GALGallery   $glb   Necessary information for initialization.

[ Top ]

method add [line 146]

GALImage add( array $values, [bool $super = false])

Create a new GALImage.

After creating a new GALImage, create a new GALInstance with instanceID = GAL_IMG_RAW and the unchanged image data. The parameter $values is an associative array with the following fields:

  • $values['owner'] GALUser optional The new image's owner, default: The user currently logged in.
  • $values['series'] GALSeries optional The new image's series, default series 1.
  • $values['film'] GALFilm optional The new image's film, default film 1.
  • $values['permission'] int required The new image's permission, values GAL_PERMISSION_PRIVATE, GAL_PERMISSION_PROTECTED or GAL_PERMISSION_PUBLIC.
  • $values['tag'] int optional The new image's tag.
  • $values['path'] string required The image data's file name. This file is not changed inside this function. Of course read access is needed.
  • $values['readmode'] int optional one of GALBlob::NOCACHE, GALBlob::COPY, GALBlob::RENAME, GALBlob::MOVE_UPLOADED or GALBlob::STREAM.
  • $values['mimeType'] string optional The MIME type of the image data, default: guessing with "file".
  • $value['extension'] string required The correct file extension of the image data; eg 'jpeg' for a JPEG image. This isn't determined automatically.
  • $values['sortHint'] int optional The new image's sortHint property, default 0.
  • $values['title'] string recommended The new image's title, default '(none)'.
  • $values['comment'] string recommended The new image's commentary text, default ''.
  • $values['direction'] string optional The text direction, one of 'ltr' or 'rtl', default 'ltr'.
  • $values['direction'] string optional The image orientation, one of '0', '90', '180', '270', default '0'.
  • $values['oldFileName'] string optional The new image's oldFileName property, default basename($values['path']).
  • $values['copyright'] string optional The new image's copyright property, default ''.
  • $values['annotation'] string optional The new image's annotation text (included in image data when converting).




Tags:

return:  the newly created image.


Parameters:

array   $values   Array with data for image creation.
bool   $super   If true, override permission checks.

[ Top ]

method buildResult [line 68]

GALImageIterator buildResult( resource $result)

Creates a GALImageIterator.

This method is used to build an iterator from a query result. It re-implements the GALResultFactory::buildResult() method.




Overrides GALTable::buildResult() (Implements the GALResultFactory interface.)

Parameters:

resource   $result  

[ Top ]

method getInstanceConfigSection [line 342]

GALSection getInstanceConfigSection( int $instanceID)

Returns the config file section that contains the "recipe" for this instance size.



Parameters:

int   $instanceID   A valid instanceID.

[ Top ]

method guessExtensionFromConfig [line 297]

string guessExtensionFromConfig( int $instanceID, GALBlob $sourceBlob)

Guess the image format the raw image data should be converted to.

The algorithm to determine the correct/optimal image format for thumbnails etc. is somewhat complicated, because it honors multiple config file options. It is externalized here.




Tags:

return:  The proposed file extension.


Parameters:

int   $instanceID   The new instance's ID.
GALBlob   $sourceBlob   The GALBlob of the source data.

[ Top ]

method instancesWithAnnotation [line 326]

array instancesWithAnnotation( )

Returns the instance ID's which get an annotation.

This method returns an array of instanceIDs which get an annotation when converted. By default only GAL_IMG_MEDIUM and GAL_IMG_BIG get an annotation, because there wouldn't be enough space for annotations on thumbnails.




Tags:

return:  of int


[ Top ]

method visible [line 81]

GALExpression visible( )

SQL expression that is TRUE only for images visible to the user currently logged in.

Images with trashFlag set, visibleFlag unset, uploadFlag set or locked images, and images where the user currently logged in hasn't got the permission to see them are considered invisible. This method doesn't use the advanced SQL comparison class GALExpressionCompare, because it was derivated from existing code ;-).




Tags:

return:  A SQL logical expression that evaluates to TRUE for visible images.


Overrides GALGallueTable::visible() (SQL expression that is TRUE only for items visible to the user currently logged in.)

[ Top ]

method writeable [line 105]

GALExpression writeable( )

SQL expression that is TRUE only for images writeable by the user currently logged in.

Images with trashFlag set, visibleFlag unset, uploadFlag set or locked images, and images where the user currently logged in hasn't got the permission to write are considered unwriteable. This method doesn't use the advanced SQL comparison class GALExpressionCompare, because it was derivated from existing code ;-).




Tags:

return:  A SQL logical expression that evaluates to TRUE for writeable images.


Overrides GALGallueTable::writeable() (SQL expression that is TRUE only for items writeable by the user currently logged in.)

[ Top ]


Documentation generated on Wed, 16 Aug 2006 15:36:12 +0200 by phpDocumentor 1.3.0RC6