[pLog-svn] r1514 - in plog/trunk/class/gallery: . dao data
getid3resizers template
Mark Wu
markplace at gmail.com
Wed Mar 16 04:04:06 GMT 2005
HI Oscar:
Do you mean you just upgrade the getid3 to new version? I need to check it
... Because I remember I commit a patch long time ago to prevent "space in
folder name" problem.
I really need to document it :( sorry
Regards, Mark
-----Original Message-----
From: plog-svn-bounces at devel.plogworld.net
[mailto:plog-svn-bounces at devel.plogworld.net] On Behalf Of
oscar at devel.plogworld.net
Sent: Wednesday, March 16, 2005 3:53 AM
To: plog-svn at devel.plogworld.net
Subject: [pLog-svn] r1514 - in plog/trunk/class/gallery: . dao data
getid3resizers template
Author: oscar
Date: 2005-03-15 19:52:38 +0000 (Tue, 15 Mar 2005)
New Revision: 1514
Modified:
plog/trunk/class/gallery/dao/galleryalbum.class.php
plog/trunk/class/gallery/dao/galleryalbums.class.php
plog/trunk/class/gallery/dao/galleryresource.class.php
plog/trunk/class/gallery/dao/galleryresourcequotas.class.php
plog/trunk/class/gallery/dao/galleryresources.class.php
plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
plog/trunk/class/gallery/data/galleryresourcebasemetadatareader.class.php
plog/trunk/class/gallery/data/galleryresourceimagemetadatareader.class.php
plog/trunk/class/gallery/data/galleryresourcesoundmetadatareader.class.php
plog/trunk/class/gallery/data/galleryresourcevideometadatareader.class.php
plog/trunk/class/gallery/data/galleryresourcezipmetadatareader.class.php
plog/trunk/class/gallery/galleryconstants.php
plog/trunk/class/gallery/getid3/getid3.lib.php
plog/trunk/class/gallery/getid3/getid3.php
plog/trunk/class/gallery/getid3/module.archive.rar.php
plog/trunk/class/gallery/getid3/module.archive.szip.php
plog/trunk/class/gallery/getid3/module.archive.zip.php
plog/trunk/class/gallery/getid3/module.audio-video.asf.php
plog/trunk/class/gallery/getid3/module.audio-video.bink.php
plog/trunk/class/gallery/getid3/module.audio-video.matroska.php
plog/trunk/class/gallery/getid3/module.audio-video.mpeg.php
plog/trunk/class/gallery/getid3/module.audio-video.nsv.php
plog/trunk/class/gallery/getid3/module.audio-video.quicktime.php
plog/trunk/class/gallery/getid3/module.audio-video.real.php
plog/trunk/class/gallery/getid3/module.audio-video.riff.php
plog/trunk/class/gallery/getid3/module.audio-video.swf.php
plog/trunk/class/gallery/getid3/module.audio.aac.php
plog/trunk/class/gallery/getid3/module.audio.ac3.php
plog/trunk/class/gallery/getid3/module.audio.au.php
plog/trunk/class/gallery/getid3/module.audio.avr.php
plog/trunk/class/gallery/getid3/module.audio.bonk.php
plog/trunk/class/gallery/getid3/module.audio.flac.php
plog/trunk/class/gallery/getid3/module.audio.la.php
plog/trunk/class/gallery/getid3/module.audio.lpac.php
plog/trunk/class/gallery/getid3/module.audio.midi.php
plog/trunk/class/gallery/getid3/module.audio.mod.php
plog/trunk/class/gallery/getid3/module.audio.monkey.php
plog/trunk/class/gallery/getid3/module.audio.mp3.php
plog/trunk/class/gallery/getid3/module.audio.mpc.php
plog/trunk/class/gallery/getid3/module.audio.ogg.php
plog/trunk/class/gallery/getid3/module.audio.optimfrog.php
plog/trunk/class/gallery/getid3/module.audio.rkau.php
plog/trunk/class/gallery/getid3/module.audio.shorten.php
plog/trunk/class/gallery/getid3/module.audio.tta.php
plog/trunk/class/gallery/getid3/module.audio.voc.php
plog/trunk/class/gallery/getid3/module.audio.vqf.php
plog/trunk/class/gallery/getid3/module.graphic.bmp.php
plog/trunk/class/gallery/getid3/module.graphic.gif.php
plog/trunk/class/gallery/getid3/module.graphic.jpg.php
plog/trunk/class/gallery/getid3/module.graphic.pcd.php
plog/trunk/class/gallery/getid3/module.graphic.png.php
plog/trunk/class/gallery/getid3/module.misc.exe.php
plog/trunk/class/gallery/getid3/module.misc.iso.php
plog/trunk/class/gallery/getid3/module.tag.apetag.php
plog/trunk/class/gallery/getid3/module.tag.id3v1.php
plog/trunk/class/gallery/getid3/module.tag.id3v2.php
plog/trunk/class/gallery/getid3/module.tag.lyrics3.php
plog/trunk/class/gallery/resizers/galleryabstractresizer.class.php
plog/trunk/class/gallery/resizers/gallerygdresizer.class.php
plog/trunk/class/gallery/resizers/galleryimagemagickresizer.class.php
plog/trunk/class/gallery/resizers/gallerynullresizer.class.php
plog/trunk/class/gallery/resizers/galleryresizer.class.php
plog/trunk/class/gallery/resizers/gddetector.class.php
plog/trunk/class/gallery/template/gallerytemplatetools.class.php
Log:
fixed issue 341 and at the same time, improved a bit the documentation of
the gallery/ folder
Modified: plog/trunk/class/gallery/dao/galleryalbum.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryalbum.class.php 2005-03-15 17:58:47
UTC (rev 1513)
+++ plog/trunk/class/gallery/dao/galleryalbum.class.php 2005-03-15 19:52:38
UTC (rev 1514)
@@ -4,13 +4,14 @@
include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
/**
+ * \ingroup Gallery
+ *
* Models an album, that holds resources. Every album has also several
other fields
* such as id, date of last modification, and the identifier of the
parent album
- * to which it belongs (if any)
+ * to which it belongs (if any)
*
- * The 'properties' field is a PHP array that is serialized to the
database and can be used
- * to store any arbitrary value needed, without having to make
special changes to the database
- * schema.
+ * Albums can also be nested therefore every album can have a parent
and one or more than
+ * one set of child albums.
*/
class GalleryAlbum extends DbObject
{
@@ -35,7 +36,7 @@
* @param name A string representing a valid name for the
album. Maximum 255 characters
* @param description A string representing a valid
description for the album. Maximum 65k characters.
* @param flags An integer value resulting or binary OR'ing
the following constants:
- * GALLERY_RESOURCE_PREVIEW_AVAILABLE
+ * - GALLERY_RESOURCE_PREVIEW_AVAILABLE
* (no more as of plog 0.3)
* @param parentId A valid and existing album identifier. If
none, then set this to '0'
* @param date A valid date in TIMESTAMP(14) format
Modified: plog/trunk/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryalbums.class.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/dao/galleryalbums.class.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -1,461 +1,468 @@
-<?php
-
- include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
- include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
- include_once(
PLOG_CLASS_PATH."class/gallery/dao/galleryalbum.class.php" );
- include_once(
PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
- include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
-
- /**
- * Database access for GalleryAlbum objects.
- *
- * Please keep in mind that in the context of this library, every
album has to have an user who
- * owns it. When this library is used within pLog, users don't own
albums but blogs do so we will
- * use blog identifier instead of user identifiers. The reason for
this change on how things are
- * called was that this library can also be used outside pLog, and
outside pLog we will most likely
- * not have blogs but users.
- *
- * @see GalleryAlbum
- */
- class GalleryAlbums extends Model
- {
-
- var $_childAlbums;
- var $resources;
- var $_counts;
-
- function GalleryAlbums()
- {
- $this->Model();
- $this->_childAlbums = Array();
- // to speed up things a bit...
- $this->_counts = null;
- }
-
- /**
- * Returns an array with all the albums that belong to the given
- * owner
- *
- * @param ownerId The identifier of the owner whose albums we'd
like to fetch
- * @param onlyShownAlbums Returns only those albums that have the
show_album
- * field set to true, or all of them otherwise
- * @param page
- * @param itemsPerPage
- * @return An array containing GalleryAlbum objects, representing
the
- * albums we fetched from the db.
- */
- function getUserAlbums( $ownerId, $onlyShownAlbums = false, $page =
DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
- {
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
WHERE owner_id = $ownerId";
- if( $onlyShownAlbums )
- $query .=" AND show_album = 1";
-
- return $this->_getAlbumsFromQuery( $query, $page, $itemsPerPage
);
- }
-
- /**
- * Returns a specific album from the database.
- *
- * @param id A valid album identifier.
- * @param ownerId (optional) The album should have the given
id _and_ it should
- * belong to the given user.
- * @param fetchResources (optional) Whether at the same
time, we should also fetch the
- * resources that are associated to this album. Set it to
'false' if you only need
- * to access the album and do not need to use methods such
as GalleryAlbum::getResources()
- * to fetch the resources that have been categorized under
this album. It of course
- * saves resources and database queries.
- * @param onlyShownAlbums Forces to retrieve only the albums
that have been set to appear
- * in the main page. If set to 'true', we will generate an
error if the album exists,
- * has the specified id and belongs to the specified user
_but_ it is not supposed to be
- * shown in the main page.
- * @return Returns a valid GalleryAlbum object or 'false' if
the album could not be found.
- */
- function getAlbum( $id, $ownerId = -1, $fetchResources = true,
$onlyShownAlbums = false )
- {
- // make sure that we don't have this album yet...
- if( isset($this->cache[$id])) {
- return $this->cache[$id];
- }
-
- // otherwise, continue the normal process...
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
WHERE id = $id";
- if( $ownerId != -1 )
- $query .= " AND owner_id = $ownerId";
- if( $onlyShownAlbums )
- $query .= " AND show_album = 1";
-
- return $this->_getAlbumFromQuery( $query );
- }
-
- /**
- * Returns a specific album from the database given its
'mangled name'
- *
- * @param id A valid album identifier.
- * @param ownerId (optional) The album should have the given
id _and_ it should
- * belong to the given user.
- * @param fetchResources (optional) Whether at the same
time, we should also fetch the
- * resources that are associated to this album. Set it to
'false' if you only need
- * to access the album and do not need to use methods such
as GalleryAlbum::getResources()
- * to fetch the resources that have been categorized under
this album. It of course
- * saves resources and database queries.
- * @param onlyShownAlbums Forces to retrieve only the albums
that have been set to appear
- * in the main page. If set to 'true', we will generate an
error if the album exists,
- * has the specified id and belongs to the specified user
_but_ it is not supposed to be
- * shown in the main page.
- * @return Returns a valid GalleryAlbum object or 'false' if
the album could not be found.
- */
- function getAlbumByName( $id, $ownerId = -1, $fetchResources
= true, $onlyShownAlbums = false )
- {
- // otherwise, continue the normal process...
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
WHERE mangled_name = '".Db::qstr($id)."'";
- if( $ownerId != -1 )
- $query .= " AND owner_id = $ownerId";
- if( $onlyShownAlbums )
- $query .= " AND show_album = 1";
-
- return $this->_getAlbumFromQuery( $query );
- }
-
- /**
- * @private
- */
- function _getAlbumFromQuery( $query )
- {
- $result = $this->Execute( $query );
-
- if( !$result )
- return false;
-
- if( $result->RowCount() == 0 )
- return false;
-
- $row = $result->FetchRow();
- $album = $this->_fetchAlbumInformation( $row, $fetchResources,
$onlyShownAlbums );
-
- // ...and keep a copy of the object we just fetched
- // just in case, one never knows :)
- $this->cache[$id] = $album;
-
- return $album;
- }
-
- /**
- * Returns an array with all the child albums of the given album,
but only
- * the ones at the first level (it is not recursive!)
- *
- * @param albumId The album identfitier whose children we'd like to
get.
- * @param ownerId To whom should this album belong.
- * @param onlyShownAlbums Returns only those albums that have the
show_album
- * field set to true, or all of them otherwise
- * @return An array of GalleryAlbum objects
- */
- function getChildAlbums( $albumId, $ownerId, $onlyShownAlbums =
false )
- {
- $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
- WHERE parent_id = $albumId AND
- owner_id = $ownerId";
- if( $onlyShownAlbums )
- $query .= " AND show_album = 1";
-
- return $this->_getAlbumsFromQuery( $query );
- }
-
- /**
- * @private
- * @see getUserAlbums
- */
- function _getAlbumsFromQuery( $query, $page =
DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
- {
- $result = $this->Execute( $query, $page, $itemsPerPage );
-
- // return empty array if the query didn't succeed
- if( !$result )
- return Array();
-
- $albums = Array();
- while( $row = $result->FetchRow()) {
- array_push( $albums, $this->_fetchAlbumInformation( $row ));
- }
-
- return $albums;
- }
-
- /**
- * Adds an album to the database
- *
- * @
- * @return Returns true if successful or false otherwise.
- */
- function addAlbum( $album )
- {
- $tf = new Textfilter();
- $query = "INSERT INTO ".$this->getPrefix()."gallery_albums (
- owner_id, description, name, flags, parent_id,
properties,
- show_album, normalized_name, normalized_description,
mangled_name )
- VALUES (".
- $album->getOwnerId().",
'".Db::qstr($album->getDescription())."', '".
- Db::qstr($album->getName())."', 0,
".$album->getParentId().", '".
- serialize($album->getProperties())."', 1,'".
- $tf->normalizeText($album->getName())."','".
- $tf->normalizeText($album->getDescription())."', '".
-
$tf->urlize($album->getName())."');";
-
- $result = $this->Execute( $query );
-
- if( !$result )
- return false;
-
- // return the id of the last row we inserted, which will be the
id of the album
- $result = $this->_db->Insert_ID();
-
- return $result;
- }
-
- /**
- * @private
- */
- function getNumChildren( $albumId )
- {
- $query = "SELECT COUNT(*) AS num_children FROM
".$this->getPrefix()."gallery_albums
- WHERE parent_id = $albumId";
- $result = $this->Execute( $query );
- if( !$result )
- return 0;
-
- $row = $result->FetchRow();
-
- return $row["num_children"];
- }
-
- /**
- * updates an album in the db
- *
- * @param album A GalleryAlbum object that already exists in the
db.
- * @param Returns true if successful or false otherwise.
- */
- function updateAlbum( $album )
- {
- if ($album->getId() == $album->getParentId()){
- return false;
- }
- $tf = new TextFilter();
- $query = "UPDATE ".$this->getPrefix()."gallery_albums SET
- description =
'".Db::qstr($album->getDescription())."',
- name = '".Db::qstr($album->getName())."',
- parent_id = ".$album->getParentId().",
- properties =
'".serialize($album->getProperties())."',
- show_album = ".$album->getShowAlbum().",
- normalized_name =
'".$tf->normalizeText($album->getName())."',
- normalized_description =
'".$tf->normalizeText($album->getDescription())."',
- mangled_name =
'".$tf->urlize($album->getName())."'
- WHERE id = ".$album->getId().";";
-
- return $this->Execute( $query );
- }
-
- /**
- * removes an album from the db
- *
- * @param albumId The album identifier
- * @param ownerId The user identifier to whom the album belongs
(optional)
- * @return True if successful or false otherwise.
- */
- function deleteAlbum( $albumId, $userId = -1 )
- {
- $query = "DELETE FROM ".$this->getPrefix()."gallery_albums
- WHERE id = $albumId";
- if( $userId != -1 )
- $query .= " AND owner_id = $userId";
-
- return $this->Execute( $query );
- }
-
- /**
- * @private
- */
- function _getNumResourcesOld( $albumId )
- {
- $query = "SELECT COUNT(*) AS total FROM
".$this->getPrefix()."gallery_resources
- WHERE album_id = $albumId";
-
- $result = $this->Execute( $query );
-
- if( !$result )
- return 0;
-
- $row = $result->FetchRow();
-
- if( $row["total"] == "" )
- return 0;
- else
- return $row["total"];
- }
-
- /**
- * @private
- * Alternative version as the above, faster when loading
lots of albums
- */
- function _getNumResources( $albumId )
- {
- // if we haven't loaded them all yet...
- $prefix = $this->getPrefix();
- if( $this->_counters == null ) {
- $query = "SELECT album_id, COUNT(*) AS total
FROM {$prefix}gallery_resources GROUP BY album_id";
-
- $result = $this->Execute( $query );
-
- if( !$result )
- return 0;
-
- while( $row = $result->FetchRow()) {
- $id = $row["album_id"];
- $this->_counters[$id] =
$row["total"];
- }
- }
-
- $total = $this->_counters[$albumId];
-
- if( $total == "" ) $total = 0;
-
- return $total;
- }
-
- /**
- * returns how many albums this user has
- *
- * @param userId
- * @return The number of albums, or 0 if none or error
- */
- function getNumUserAlbums( $userId )
- {
- $prefix = $this->getPrefix();
- $table = "{$prefix}gallery_albums";
- $cond = "owner_id = '".Db::qstr($userId)."'";
-
- return( $this->getNumItems( $table, $cond ));
- }
-
- /**
- * returns all the albums of the blog in an array. The key
of the array is the
- * parent id of all the albums in the position, and each
position is either an
- * array with all the albums that share the same parent id
or empty if none
- *
- * @param userId
- * @param albumId
- * @return An associative array
- */
- function getUserAlbumsGroupedByParentId( $userId, $albumId =
0 )
- {
- $prefix = $this->getPrefix();
- $query = "SELECT * FROM {$prefix}gallery_albums
- WHERE owner_id = '".Db::qstr($userId)."'
- ORDER BY name ASC";
-
- $result = $this->Execute( $query );
-
- if( !$result )
- return Array();
-
- $albums = Array();
- $ids = Array();
- $ids[] = 0;
- while( $row = $result->FetchRow()) {
- $album = new GalleryAlbum( $row["owner_id"],
-
$row["name"],
-
$row["description"],
-
$row["flags"],
-
$row["parent_id"],
-
$row["date"],
-
unserialize($row["properties"]),
-
$row["show_album"],
-
$row["id"] );
- $key = $album->getParentId();
- if( $albums["$key"] == "" )
- $albums["$key"] = Array();
- $albums["$key"][] = $album;
-
- $ids[] = $album->getId();
- }
-
- return $albums;
- }
-
- /**
- * returns the albums of a blog ordered in the same way as
they are nested. Please use
- * $album->getValue("level") to check their proper nesting.
- *
- * @param userId
- */
- function getNestedAlbumList( $userId )
- {
- $albums = $this->getUserAlbumsGroupedByParentId(
$userId );
- $nestedAlbums = $this->_getNestedAlbumList( $albums
);
-
- return $nestedAlbums;
- }
-
-
- /**
- * @static
- * @private
- */
- function _getNestedAlbumList( $albums, $start = 0, $level =
-1 )
- {
- $level++;
- if( $albums["$start"] == "" )
- return Array();
-
- foreach( $albums["$start"] as $album ) {
- // do the replacing
- $album->setValue( "level", $level );
- $results[] = $album;
-
- // make a recursive call
- $tmp = $this->_getNestedAlbumList( $albums,
$album->getId(), $level);
- foreach( $tmp as $tmpAlbum )
- $results[] = $tmpAlbum;
- }
-
- return $results;
- }
-
- /**
- * @private
- */
- function _fetchAlbumInformation( $row, $fetchResources = true,
$onlyShownAlbums = false )
- {
- $album = new GalleryAlbum( $row["owner_id"],
- $row["name"],
- $row["description"],
- $row["flags"],
- $row["parent_id"],
- $row["date"],
- unserialize($row["properties"]),
- $row["show_album"],
- $row["id"] );
-
- // fetch the number of children and the GalleryAlbum child
- // objects that "hang" from this one
- //$album->setNumChildren( $this->getNumChildren($row["id"]));
- $id = $row["id"];
- $ownerId = $row["owner_id"];
- if( !isset($this->_childAlbums[$id])) {
- $this->_childAlbums[$id] =
$this->getChildAlbums( $id, $ownerId );
- }
- $album->setChildren( $this->_childAlbums[$id] );
-
- $album->setNumResources( $this->_getNumResources( $id ));
-
- // fetch the resources that belong to this album
- /*if( $fetchResources ) {
- $this->log->debug("fetching resources for
album id = $id<br/>");
- if( $this->resources == "" )
- $this->resources = new
GalleryResources();
- $albumResources = $this->resources->getUserResources(
$row["owner_id"], $id );
- $album->setResources( $albumResources );
- }*/
-
- return $album;
- }
- }
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
+ include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
+ include_once(
PLOG_CLASS_PATH."class/gallery/dao/galleryalbum.class.php" );
+ include_once(
PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+
+ /**
+ * \ingroup Gallery
+ *
+ * Database access for GalleryAlbum objects.
+ *
+ * Please keep in mind that in the context of this library, every
album has to have an user who
+ * owns it. When this library is used within pLog, users don't own
albums but blogs do so we will
+ * use blog identifier instead of user identifiers. The reason for
this change on how things are
+ * called was that this library can also be used outside pLog, and
outside pLog we will most likely
+ * not have blogs but users.
+ *
+ * @see GalleryAlbum
+ * @see Model
+ */
+ class GalleryAlbums extends Model
+ {
+
+ var $_childAlbums;
+ var $resources;
+ var $_counts;
+
+ /**
+ * Constructor. Calls the Model constructor and does nothing
more.
+ */
+ function GalleryAlbums()
+ {
+ $this->Model();
+ $this->_childAlbums = Array();
+ // to speed up things a bit...
+ $this->_counts = null;
+ }
+
+ /**
+ * Returns an array with all the albums that belong to the given
+ * owner
+ *
+ * @param ownerId The identifier of the owner whose albums we'd
like to fetch
+ * @param onlyShownAlbums Returns only those albums that have the
show_album
+ * field set to true, or all of them otherwise
+ * @param page The page we'd like to see
+ * @param itemsPerPage number of items per page
+ * @return An array containing GalleryAlbum objects,
representing the
+ * albums we fetched from the db.
+ */
+ function getUserAlbums( $ownerId, $onlyShownAlbums = false, $page =
DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
+ {
+ $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
WHERE owner_id = $ownerId";
+ if( $onlyShownAlbums )
+ $query .=" AND show_album = 1";
+
+ return $this->_getAlbumsFromQuery( $query, $page, $itemsPerPage
);
+ }
+
+ /**
+ * Returns a specific album from the database.
+ *
+ * @param id A valid album identifier.
+ * @param ownerId (optional) The album should have the given
id _and_ it should
+ * belong to the given user.
+ * @param fetchResources (optional) Whether at the same
time, we should also fetch the
+ * resources that are associated to this album. Set it to
'false' if you only need
+ * to access the album and do not need to use methods such
as GalleryAlbum::getResources()
+ * to fetch the resources that have been categorized under
this album. It of course
+ * saves resources and database queries.
+ * @param onlyShownAlbums Forces to retrieve only the albums
that have been set to appear
+ * in the main page. If set to 'true', we will generate an
error if the album exists,
+ * has the specified id and belongs to the specified user
_but_ it is not supposed to be
+ * shown in the main page.
+ * @return Returns a valid GalleryAlbum object or 'false' if
the album could not be found.
+ */
+ function getAlbum( $id, $ownerId = -1, $fetchResources = true,
$onlyShownAlbums = false )
+ {
+ // make sure that we don't have this album yet...
+ if( isset($this->cache[$id])) {
+ return $this->cache[$id];
+ }
+
+ // otherwise, continue the normal process...
+ $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
WHERE id = $id";
+ if( $ownerId != -1 )
+ $query .= " AND owner_id = $ownerId";
+ if( $onlyShownAlbums )
+ $query .= " AND show_album = 1";
+
+ return $this->_getAlbumFromQuery( $query );
+ }
+
+ /**
+ * Returns a specific album from the database given its
'mangled name'
+ *
+ * @param id A valid album identifier.
+ * @param ownerId (optional) The album should have the given
id _and_ it should
+ * belong to the given user.
+ * @param fetchResources (optional) Whether at the same
time, we should also fetch the
+ * resources that are associated to this album. Set it to
'false' if you only need
+ * to access the album and do not need to use methods such
as GalleryAlbum::getResources()
+ * to fetch the resources that have been categorized under
this album. It of course
+ * saves resources and database queries.
+ * @param onlyShownAlbums Forces to retrieve only the albums
that have been set to appear
+ * in the main page. If set to 'true', we will generate an
error if the album exists,
+ * has the specified id and belongs to the specified user
_but_ it is not supposed to be
+ * shown in the main page.
+ * @return Returns a valid GalleryAlbum object or 'false' if
the album could not be found.
+ */
+ function getAlbumByName( $id, $ownerId = -1, $fetchResources
= true, $onlyShownAlbums = false )
+ {
+ // otherwise, continue the normal process...
+ $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
WHERE mangled_name = '".Db::qstr($id)."'";
+ if( $ownerId != -1 )
+ $query .= " AND owner_id = $ownerId";
+ if( $onlyShownAlbums )
+ $query .= " AND show_album = 1";
+
+ return $this->_getAlbumFromQuery( $query );
+ }
+
+ /**
+ * @private
+ */
+ function _getAlbumFromQuery( $query )
+ {
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return false;
+
+ if( $result->RowCount() == 0 )
+ return false;
+
+ $row = $result->FetchRow();
+ $album = $this->_fetchAlbumInformation( $row, $fetchResources,
$onlyShownAlbums );
+
+ // ...and keep a copy of the object we just fetched
+ // just in case, one never knows :)
+ $this->cache[$id] = $album;
+
+ return $album;
+ }
+
+ /**
+ * Returns an array with all the child albums of the given album,
but only
+ * the ones at the first level (it is not recursive!)
+ *
+ * @param albumId The album identfitier whose children we'd like to
get.
+ * @param ownerId To whom should this album belong.
+ * @param onlyShownAlbums Returns only those albums that have the
show_album
+ * field set to true, or all of them otherwise
+ * @return An array of GalleryAlbum objects
+ */
+ function getChildAlbums( $albumId, $ownerId, $onlyShownAlbums =
false )
+ {
+ $query = "SELECT * FROM ".$this->getPrefix()."gallery_albums
+ WHERE parent_id = $albumId AND
+ owner_id = $ownerId";
+ if( $onlyShownAlbums )
+ $query .= " AND show_album = 1";
+
+ return $this->_getAlbumsFromQuery( $query );
+ }
+
+ /**
+ * @private
+ * @see getUserAlbums
+ */
+ function _getAlbumsFromQuery( $query, $page =
DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
+ {
+ $result = $this->Execute( $query, $page, $itemsPerPage );
+
+ // return empty array if the query didn't succeed
+ if( !$result )
+ return Array();
+
+ $albums = Array();
+ while( $row = $result->FetchRow()) {
+ array_push( $albums, $this->_fetchAlbumInformation( $row ));
+ }
+
+ return $albums;
+ }
+
+ /**
+ * Adds an album to the database
+ *
+ * @param album A GalleryAlbum object, with all its data
filled in
+ * @return Returns true if successful or false otherwise.
+ * @see GAlleryAlbum
+ */
+ function addAlbum( $album )
+ {
+ $tf = new Textfilter();
+ $query = "INSERT INTO ".$this->getPrefix()."gallery_albums (
+ owner_id, description, name, flags, parent_id,
properties,
+ show_album, normalized_name, normalized_description,
mangled_name )
+ VALUES (".
+ $album->getOwnerId().",
'".Db::qstr($album->getDescription())."', '".
+ Db::qstr($album->getName())."', 0,
".$album->getParentId().", '".
+ serialize($album->getProperties())."', 1,'".
+ $tf->normalizeText($album->getName())."','".
+ $tf->normalizeText($album->getDescription())."', '".
+
$tf->urlize($album->getName())."');";
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return false;
+
+ // return the id of the last row we inserted, which will be the
id of the album
+ $result = $this->_db->Insert_ID();
+
+ return $result;
+ }
+
+ /**
+ * @private
+ */
+ function getNumChildren( $albumId )
+ {
+ $query = "SELECT COUNT(*) AS num_children FROM
".$this->getPrefix()."gallery_albums
+ WHERE parent_id = $albumId";
+ $result = $this->Execute( $query );
+ if( !$result )
+ return 0;
+
+ $row = $result->FetchRow();
+
+ return $row["num_children"];
+ }
+
+ /**
+ * updates an album in the db
+ *
+ * @param album A GalleryAlbum object that already exists in the
db.
+ * @param Returns true if successful or false otherwise.
+ */
+ function updateAlbum( $album )
+ {
+ if ($album->getId() == $album->getParentId()){
+ return false;
+ }
+ $tf = new TextFilter();
+ $query = "UPDATE ".$this->getPrefix()."gallery_albums SET
+ description =
'".Db::qstr($album->getDescription())."',
+ name = '".Db::qstr($album->getName())."',
+ parent_id = ".$album->getParentId().",
+ properties =
'".serialize($album->getProperties())."',
+ show_album = ".$album->getShowAlbum().",
+ normalized_name =
'".$tf->normalizeText($album->getName())."',
+ normalized_description =
'".$tf->normalizeText($album->getDescription())."',
+ mangled_name =
'".$tf->urlize($album->getName())."'
+ WHERE id = ".$album->getId().";";
+
+ return $this->Execute( $query );
+ }
+
+ /**
+ * removes an album from the db
+ *
+ * @param albumId The album identifier
+ * @param userId The user identifier to whom the album belongs
(optional)
+ * @return True if successful or false otherwise.
+ */
+ function deleteAlbum( $albumId, $userId = -1 )
+ {
+ $query = "DELETE FROM ".$this->getPrefix()."gallery_albums
+ WHERE id = $albumId";
+ if( $userId != -1 )
+ $query .= " AND owner_id = $userId";
+
+ return $this->Execute( $query );
+ }
+
+ /**
+ * @private
+ */
+ function _getNumResourcesOld( $albumId )
+ {
+ $query = "SELECT COUNT(*) AS total FROM
".$this->getPrefix()."gallery_resources
+ WHERE album_id = $albumId";
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return 0;
+
+ $row = $result->FetchRow();
+
+ if( $row["total"] == "" )
+ return 0;
+ else
+ return $row["total"];
+ }
+
+ /**
+ * @private
+ * Alternative version as the above, faster when loading
lots of albums
+ */
+ function _getNumResources( $albumId )
+ {
+ // if we haven't loaded them all yet...
+ $prefix = $this->getPrefix();
+ if( $this->_counters == null ) {
+ $query = "SELECT album_id, COUNT(*) AS total
FROM {$prefix}gallery_resources GROUP BY album_id";
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return 0;
+
+ while( $row = $result->FetchRow()) {
+ $id = $row["album_id"];
+ $this->_counters[$id] =
$row["total"];
+ }
+ }
+
+ $total = $this->_counters[$albumId];
+
+ if( $total == "" ) $total = 0;
+
+ return $total;
+ }
+
+ /**
+ * returns how many albums this user has
+ *
+ * @param userId The number of albums that this user has
+ * @return The number of albums, or 0 if none or error
+ */
+ function getNumUserAlbums( $userId )
+ {
+ $prefix = $this->getPrefix();
+ $table = "{$prefix}gallery_albums";
+ $cond = "owner_id = '".Db::qstr($userId)."'";
+
+ return( $this->getNumItems( $table, $cond ));
+ }
+
+ /**
+ * returns all the albums of the blog in an array. The key
of the array is the
+ * parent id of all the albums in the position, and each
position is either an
+ * array with all the albums that share the same parent id
or empty if none
+ *
+ * @param userId
+ * @param albumId
+ * @return An associative array
+ */
+ function getUserAlbumsGroupedByParentId( $userId, $albumId =
0 )
+ {
+ $prefix = $this->getPrefix();
+ $query = "SELECT * FROM {$prefix}gallery_albums
+ WHERE owner_id = '".Db::qstr($userId)."'
+ ORDER BY name ASC";
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return Array();
+
+ $albums = Array();
+ $ids = Array();
+ $ids[] = 0;
+ while( $row = $result->FetchRow()) {
+ $album = new GalleryAlbum( $row["owner_id"],
+
$row["name"],
+
$row["description"],
+
$row["flags"],
+
$row["parent_id"],
+
$row["date"],
+
unserialize($row["properties"]),
+
$row["show_album"],
+
$row["id"] );
+ $key = $album->getParentId();
+ if( $albums["$key"] == "" )
+ $albums["$key"] = Array();
+ $albums["$key"][] = $album;
+
+ $ids[] = $album->getId();
+ }
+
+ return $albums;
+ }
+
+ /**
+ * returns the albums of a blog ordered in the same way as
they are nested. Please use
+ * $album->getValue("level") to check their proper nesting.
+ *
+ * @param userId
+ */
+ function getNestedAlbumList( $userId )
+ {
+ $albums = $this->getUserAlbumsGroupedByParentId(
$userId );
+ $nestedAlbums = $this->_getNestedAlbumList( $albums
);
+
+ return $nestedAlbums;
+ }
+
+
+ /**
+ * @static
+ * @private
+ */
+ function _getNestedAlbumList( $albums, $start = 0, $level =
-1 )
+ {
+ $level++;
+ if( $albums["$start"] == "" )
+ return Array();
+
+ foreach( $albums["$start"] as $album ) {
+ // do the replacing
+ $album->setValue( "level", $level );
+ $results[] = $album;
+
+ // make a recursive call
+ $tmp = $this->_getNestedAlbumList( $albums,
$album->getId(), $level);
+ foreach( $tmp as $tmpAlbum )
+ $results[] = $tmpAlbum;
+ }
+
+ return $results;
+ }
+
+ /**
+ * @private
+ */
+ function _fetchAlbumInformation( $row, $fetchResources = true,
$onlyShownAlbums = false )
+ {
+ $album = new GalleryAlbum( $row["owner_id"],
+ $row["name"],
+ $row["description"],
+ $row["flags"],
+ $row["parent_id"],
+ $row["date"],
+ unserialize($row["properties"]),
+ $row["show_album"],
+ $row["id"] );
+
+ // fetch the number of children and the GalleryAlbum child
+ // objects that "hang" from this one
+ //$album->setNumChildren( $this->getNumChildren($row["id"]));
+ $id = $row["id"];
+ $ownerId = $row["owner_id"];
+ if( !isset($this->_childAlbums[$id])) {
+ $this->_childAlbums[$id] =
$this->getChildAlbums( $id, $ownerId );
+ }
+ $album->setChildren( $this->_childAlbums[$id] );
+
+ $album->setNumResources( $this->_getNumResources( $id ));
+
+ // fetch the resources that belong to this album
+ /*if( $fetchResources ) {
+ $this->log->debug("fetching resources for
album id = $id<br/>");
+ if( $this->resources == "" )
+ $this->resources = new
GalleryResources();
+ $albumResources = $this->resources->getUserResources(
$row["owner_id"], $id );
+ $album->setResources( $albumResources );
+ }*/
+
+ return $album;
+ }
+ }
?>
\ No newline at end of file
Modified: plog/trunk/class/gallery/dao/galleryresource.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresource.class.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/dao/galleryresource.class.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -14,7 +14,15 @@
define('GETID3_HELPERAPPSDIR', 'no_helper_apps_needed');
/**
+ * \ingroup Gallery
+ *
* Encapsulates a resource from our database.
+ *
+ * Each GalleryResource object can belong to only one GalleryAlbum
object, and therefore every object
+ * has a reference to its album.
+ *
+ * This class also provides methods for getting the correct metadata
reader, for checking the type of the
+ * resource, for getting access to the thumbnail of the object, etc.
*/
class GalleryResource extends DbObject
{
@@ -31,7 +39,32 @@
var $_metadata;
var $_album;
var $_thumbnailFormat;
-
+
+ /**
+ * Constructor.
+ *
+ * @param ownerId Id of the user to whom this resource
belongs
+ * @param albumId The id of the GalleryAlbum object to which
this resource belongs
+ * @param description Description of this file
+ * @param flags As of pLog 1.0, there is only one flag
available: GALLERY_RESOURCE_PREVIEW_AVAILABLE.
+ * @param resourceType The type of the resource. One of the
following constants:
+ * - GALLERY_RESOURCE_IMAGE
+ * - GALLERY_RESOURCE_VIDEO
+ * - GALLERY_RESOURCE_SOUND
+ * - GALLERY_RESOURCE_UNKNOWN
+ * - GALLERY_RESOURCE_DOCUMENT
+ * - GALLERY_RESOURCE_ZIP
+ * @param filePath path in disk to the real file. Not used.
+ * @param fileName name of the file, which is not exactly
the same name that the file has in disk, since the
+ * GalleryResourceStorage class is taking care of managing
things in disk. Nevertheless, this is the file that will
+ * be shown to users in the user interface
+ * @param metadata An array, as generated by the getID3
class.
+ * @param date A SQL date
+ * @param thumbnailFormat The format of the thumbnail
+ * @param id Optinally, the id. When creating new resources,
the GalleryResources::addResource() method will
+ * update the id so it does not matter what we provide here.
+ * @see getID3
+ */
function GalleryResource( $ownerId, $albumId, $description, $flags,
$resourceType,
$filePath, $fileName, $metadata, $date,
$thumbnailFormat, $id = -1 )
{
@@ -49,51 +82,85 @@
$this->_id = $id;
}
+ /**
+ * @return the identifier of the resource, or -1 if none has
been set yet.
+ */
function getId()
{
return $this->_id;
}
+ /**
+ * @return the identifier of the owner of this resource
+ */
function getOwnerId()
{
return $this->_ownerId;
}
+ /**
+ * @return returns the identifier of the GalleryAlbum object
to which this resource belongs
+ */
function getAlbumId()
{
return $this->_albumId;
}
+ /**
+ * @return Returns a 14-digit SQL date
+ */
function getDate()
{
return $this->_date;
}
+ /**
+ * @return Returns a Timestamp object
+ * @see Timestamp
+ */
function getTimestamp()
{
return new Timestamp($this->_date);
}
+ /**
+ * @return returns the "raw" metadata information, as
generated by the getID3 class. It is
+ * advisable to use the
GalleryResource::getResourceMetadataReader to get the right
+ * metadata reader class, since these classes provide
convenience methods for accessing
+ * the most common attributes of sound files, videos, etc.
+ */
function getMetadata()
{
return $this->_metadata;
}
+ /**
+ * @return the flags of the resource object
+ */
function getFlags()
{
return $this->_flags;
}
+ /**
+ * @return The path of the file in disk
+ */
function getFilePath()
{
return $this->_filePath;
}
+ /**
+ * @return the name of the file in disk
+ */
function getFileName()
{
return $this->_fileName;
}
+ /**
+ * @return the description of the resource
+ */
function getDescription()
{
return $this->_description;
@@ -146,31 +213,56 @@
return $this->_getData( $fileName );
}
+ /**
+ * Sets the album id. You should normally not need to use
this method
+ *
+ * @param albumId The id of the album
+ */
function setAlbumId( $albumId )
{
$this->_albumId = $albumId;
}
+ /**
+ * Sets the GalleryAlbum object to which this file belongs
+ */
function setAlbum( $album )
{
$this->_album = $album;
}
+ /**
+ * @return The GalleryAlbum object to which this resource
belongs
+ */
function getAlbum()
{
return $this->_album;
}
+ /**
+ * Sets the descriptoion of the object
+ *
+ * @param description the new description
+ */
function setDescription( $description )
{
$this->_description = $description;
}
+ /**
+ * @return returns the format of the thumbnail that was
generated for this file, if any. Of
+ * course this method has no relevance if the object is not
representing an image
+ */
function getThumbnailFormat()
{
return $this->_thumbnailFormat;
}
+ /**
+ * Sets the thumbnail format
+ *
+ * @return nothing
+ */
function setThumbnailFormat( $format )
{
$this->_thumbnailFormat = $format;
@@ -334,22 +426,33 @@
}
}
-
+ /**
+ * @return true if the resource is an image
+ */
function isImage()
{
return( $this->_resourceType == GALLERY_RESOURCE_IMAGE );
}
+ /**
+ * @return true if the resource is a sound file
+ */
function isSound()
{
return( $this->_resourceType == GALLERY_RESOURCE_SOUND );
}
+ /**
+ * @return true if the resource file is a video
+ */
function isVideo()
{
return( $this->_resourceType == GALLERY_RESOURCE_VIDEO );
}
+ /**
+ * @return true if the resource file is a ZIP file
+ */
function isZip()
{
return( $this->_resourceType == GALLERY_RESOURCE_ZIP );
Modified: plog/trunk/class/gallery/dao/galleryresourcequotas.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresourcequotas.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/dao/galleryresourcequotas.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -8,6 +8,8 @@
define( "GLOBAL_QUOTA_DEFAULT", 5000000 );
/**
+ * \ingroup Gallery
+ *
* returns information about quotas, both global-wise and per-blog
quotas
*/
class GalleryResourceQuotas extends Object
Modified: plog/trunk/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresources.class.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/dao/galleryresources.class.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -1,5 +1,17 @@
<?php
+ /**
+ * \defgroup Gallery
+ *
+ * The pLog Gallery module encapsulates all the logic necessary for:
+ *
+ * - Dealing with files and their places in disk
+ * - Dealing with albums, which are virtual groups of disks
+ * - Automatic generation of thumbnails and medium-sized thumbnails,
according to our configuration
+ * - Automatic extraction of metadata from a set of supported
formats. This is achieved
+ * via the getID3 library.
+ */
+
include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
include_once(
PLOG_CLASS_PATH."class/gallery/dao/galleryresource.class.php" );
@@ -15,7 +27,13 @@
include_once(
PLOG_CLASS_PATH."class/gallery/dao/galleryresourcequotas.class.php" );
/**
- * database access for GalleryResource objects
+ * \ingroup Gallery
+ *
+ * database access for GalleryResource objects. Provides methods for
adding, retrieving, updating and removing
+ * resources from the database
+ *
+ * @see Model
+ * @see GalleryResource
*/
class GalleryResources extends Model
{
@@ -68,8 +86,8 @@
* Fetches GalleryResource objects from the database
*
* @param resourceId The id of the resource we'd like to fetch
- * @param ownerId
- * @param albumId
+ * @param ownerId Optional, the id of the owner
+ * @param albumId Optional, the id of the album to which
this resoruce should belong
* @return Returns a GalleryResource object representing the
resource
*/
function getResource( $resourceId, $ownerId = -1, $albumId = -1 )
@@ -97,6 +115,7 @@
/**
* given a resource id, tries to find the next one in the
sequence
+ *
* @param resource A GalleryResource object that represents
the resource whose next
* object we'd like to load
* @return Returns a GalleryResource object representing the next
resource, or false
@@ -126,6 +145,7 @@
/**
* given a resource id, tries to find the previus one in the
sequence
+ *
* @param resource A GalleryResource object that represents
the resource whose next
* object we'd like to load
* @return Returns a GalleryResource object representing the
previous resource, or false
@@ -220,9 +240,11 @@
/**
* returns the number of items given certain conditions
*
- * @param ownerId
- * @param albumId
- * @param resourceType
+ * @param ownerId The id of the user whose amount of albums
we'd like to check
+ * @param albumId Optional, the id of the album, in case
we'd only like to know the number of resources in a certain album.
+ * use the constant GALLERY_NO_ALBUM to disable this
parameter
+ * @param resourceType An additional filter parameter, so
that we can only count a certain type of resources.
+ * Defaults to the constant GALLERY_RESOURCE_ANY
* @see getUserResources
* @return the total number of items
*/
@@ -258,7 +280,9 @@
}
/**
- * Adds a row related to this resource to the database
+ * Adds a row related to a resource to the database. You
should usually use
+ * GalleryResources::addResource() or
GalleryResources::addResourceFromDisk(), which are more
+ * suitable and will do most of the job for you.
*
* @param ownerId
* @param albumId
@@ -320,7 +344,7 @@
}
/**
- * generates the thumbnail of a file that we have just added
+ * generates the thumbnail of a file that we have just
added.
*
* @param resFile the resource file from which we're trying
to generate the
* thubmail.
@@ -392,13 +416,31 @@
$this->log->debug( " resourceId = $resourceId" );
// and finally, we can generate the preview!
- $result = $resizer->generate( $outFile,
$previewHeight, $previewWidth, $previewKeepAspectRatio );
+ $result = $resizer->generate( $outFile,
$previewWidth, $previewHeight, $previewKeepAspectRatio );
return $result;
}
/**
- * adds a resource to the database
+ * adds a resource to the database. This method requires a
FileUpload parameter and it
+ * will take care of processing the upload file and so on.
If the file is already in disk and we'd
+ * like to add it, please check
GalleryResources::addResourceFromDisk()
+ * This method will also take care of extracting the
metadata from the file and generating the
+ * thumbnail in the required format, according to our
configuration.
+ *
+ * @param ownerId
+ * @param albumId
+ * @param description
+ * @param upload A FileUpload object
+ * @see FileUpload
+ * @see GalleryResources::addResourceFromDisk()
+ * @return It will return one of the following constants:
+ * - GALLERY_ERROR_RESOURCE_TOO_BIG
+ * - GALLERY_ERROR_RESOURCE_FORBIDDEN_EXTENSION
+ * - GALLERY_ERROR_QUOTA_EXCEEDED
+ * - GALLERY_ERROR_ADDING_RESOURCE
+ * - GALLERY_ERROR_UPLOADS_NOT_ENABLED
+ * or the identifier of the resource that was just added if
the operation succeeded.
*/
function addResource( $ownerId, $albumId, $description, $upload )
{
@@ -469,13 +511,22 @@
/**
* adds a resource to the gallery when the resource is already
stored on disk, instead of
- * it coming from an upload as it usually happens.
+ * it coming from an upload as it usually happens. This method is
better than
+ * GalleryResources::addResource() when instead of dealing
with uploaded files, the file
+ * is already in disk and all that is left to do is to add
it to the database.
*
* @param ownerId
* @param albumId
* @param description
- * @param fullFilePath
- * @return Returns the id of the resource that was created or false
otherwise
+ * @param fullFilePath The real path where the file is stored. This
is expected to be
+ * its final and permanent destination
+ * @return It will return one of the following constants:
+ * - GALLERY_ERROR_RESOURCE_TOO_BIG
+ * - GALLERY_ERROR_RESOURCE_FORBIDDEN_EXTENSION
+ * - GALLERY_ERROR_QUOTA_EXCEEDED
+ * - GALLERY_ERROR_ADDING_RESOURCE
+ * - GALLERY_ERROR_UPLOADS_NOT_ENABLED
+ * or the identifier of the resource that was just added if
the operation succeeded.
*/
function addResourceFromDisk( $ownerId, $albumId, $description,
$fullFilePath )
{
@@ -575,6 +626,7 @@
*
* @param resource A GalleryResource object with the information of
the
* resource we'd like to update.
+ * @return Returns true if successful or false otherwise
*/
function updateResource( $resource )
{
Modified: plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -11,7 +11,10 @@
define( "RESOURCE_STORAGE_STORE_MOVE", 2 );
/**
- * Takes care of dealing with resource files on disk
+ * \ingroup Gallery
+ *
+ * Takes care of dealing with resource files on disk. This class hides
all the intricacies of storing
+ * files in disk, and how they are found and handled later on.
*/
class GalleryResourceStorage extends Object
{
Modified:
plog/trunk/class/gallery/data/galleryresourcebasemetadatareader.class.php
===================================================================
---
plog/trunk/class/gallery/data/galleryresourcebasemetadatareader.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++
plog/trunk/class/gallery/data/galleryresourcebasemetadatareader.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -4,6 +4,8 @@
include_once( PLOG_CLASS_PATH."class/data/stringutils.class.php" );
/**
+ * \ingroup Gallery
+ *
* acts as some kind of decorator adding getter methods for getting
* some information straight from the metadata field of the resource
object,
* without having to overload the basic GalleryResource object with
thousands
@@ -20,6 +22,11 @@
* print( "image size:
".$reader->getHeight()."x".$reader->getWidth()." pixels" );
* }
* </pre>
+ *
+ * The method GalleryResource::getResourceMetadataReader() will
return the right
+ * metadata reader class so that we can check the properties of the
file. We can either query
+ * the methods GalleryResource::isImage(),
GalleryResource::isVideo(), etc to know which properties
+ * we can check, or use PHP's function for checking of which type a
class is.
*/
class GalleryResourceBaseMetadataReader extends Object
{
Modified:
plog/trunk/class/gallery/data/galleryresourceimagemetadatareader.class.php
===================================================================
---
plog/trunk/class/gallery/data/galleryresourceimagemetadatareader.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++
plog/trunk/class/gallery/data/galleryresourceimagemetadatareader.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -3,30 +3,55 @@
include_once(
PLOG_CLASS_PATH."class/gallery/data/galleryresourcebasemetadatareader.class.
php" );
/**
- * methods for fetching metadata from image resources
+ * \ingroup Gallery
+ *
+ * Retrieves information from images, regardless of the type of
image.
*/
class GalleryResourceImageMetadataReader extends
GalleryResourceBaseMetadataReader
{
+ /**
+ * constructor
+ *
+ * @param resource A GalleryResource object
+ */
function GalleryResourceImageMetadataReader( $resource )
{
$this->GalleryResourceBaseMetadataReader( $resource );
}
+ /**
+ * returns the height of the image
+ *
+ * @return the height of the image in pixels
+ */
function getHeight()
{
return $this->_metadata["video"]["resolution_y"];
}
-
+
+ /**
+ * returns the width of the image
+ *
+ * @return the width of the image in pixels
+ */
function getWidth()
{
return $this->_metadata["video"]["resolution_x"];
}
+ /**
+ * returns the exact format of the image
+ *
+ * @return a string representing the format of the image
+ */
function getFormat()
{
return $this->_metadata["video"]["dataformat"];
}
+ /**
+ * @return the number of bits per sample of the image
+ */
function getBitsPerSample()
{
return $this->_metadata["video"]["bits_per_sample"];
Modified:
plog/trunk/class/gallery/data/galleryresourcesoundmetadatareader.class.php
===================================================================
---
plog/trunk/class/gallery/data/galleryresourcesoundmetadatareader.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++
plog/trunk/class/gallery/data/galleryresourcesoundmetadatareader.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -3,6 +3,8 @@
include_once(
PLOG_CLASS_PATH."class/gallery/data/galleryresourcebasemetadatareader.class.
php" );
/**
+ * \ingroup Gallery
+ *
* methods for fetching metadata from sound resources
*/
class GalleryResourceSoundMetadataReader extends
GalleryResourceBaseMetadataReader
@@ -12,26 +14,41 @@
$this->GalleryResourceBaseMetadataReader( $resource );
}
+ /**
+ * @return the number of channels of the audio file
+ */
function getChannels()
{
return $this->_metadata["audio"]["channels"];
}
+ /**
+ * @return the rate in Hz at which the audio was sampled
+ */
function getSampleRate()
{
return $this->_metadata["audio"]["sample_rate"];
}
+ /**
+ * @return the channel mode: mono or stereo
+ */
function getChannelMode()
{
return $this->_metadata["audio"]["channelmode"];
}
+ /**
+ * @return the format of the audio file
+ */
function getFormat()
{
return $this->_metadata["audio"]["dataformat"];
}
+ /**
+ * @return a nicer, human-readable string with the length of
the file
+ */
function getLengthString()
{
return $this->_metadata["playtime_string"];
Modified:
plog/trunk/class/gallery/data/galleryresourcevideometadatareader.class.php
===================================================================
---
plog/trunk/class/gallery/data/galleryresourcevideometadatareader.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++
plog/trunk/class/gallery/data/galleryresourcevideometadatareader.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -4,6 +4,8 @@
/**
* methods for fetching metadata from video resources
+ *
+ * \ingroup Gallery
*/
class GalleryResourceVideoMetadataReader extends
GalleryResourceBaseMetadataReader
{
@@ -12,41 +14,65 @@
$this->GalleryResourceBaseMetadataReader( $resource );
}
+ /**
+ * @return the height in pixels of the video
+ */
function getHeight()
{
return $this->_metadata["video"]["resolution_y"];
}
+ /**
+ * @return the width in pixels of the video
+ */
function getWidth()
{
return $this->_metadata["video"]["resolution_x"];
}
+ /**
+ * @return the format of the video
+ */
function getFormat()
{
return $this->_metadata["video"]["dataformat"];
}
+ /**
+ * @return the bits per sample of the video
+ */
function getBitsPerSample()
{
return $this->_metadata["video"]["bits_per_sample"];
}
+ /**
+ * @return returns the codec that was used to generate the
video
+ */
function getVideoCodec()
{
return $this->_metadata["video"]["codec"];
}
+ /**
+ * @return returns the name of the codec in which the audio
was saved in the video
+ */
function getAudioCodec()
{
return $this->_metadata["audio"]["codec"];
}
+ /**
+ * @return returnsd the length in seconds of the video
+ */
function getLength()
{
return $this->_metadata["playtime_seconds"];
}
+ /**
+ * @return a nicely formatted string with the length of the
video
+ */
function getLengthString()
{
return $this->_metadata["playtime_string"];
Modified:
plog/trunk/class/gallery/data/galleryresourcezipmetadatareader.class.php
===================================================================
--- plog/trunk/class/gallery/data/galleryresourcezipmetadatareader.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/data/galleryresourcezipmetadatareader.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -3,6 +3,8 @@
include_once(
PLOG_CLASS_PATH."class/gallery/data/galleryresourcebasemetadatareader.class.
php" );
/**
+ * \ingroup Gallery
+ *
* methods for fetching metadata from zip file resources
*/
class GalleryResourceZipMetadataReader extends
GalleryResourceBaseMetadataReader
@@ -22,31 +24,59 @@
return $this->_metadata["zip"]["files"];
}
+ /**
+ * returns the total compressed size of this file
+ *
+ * @return the size in bytes
+ */
function getCompressedSize()
{
return $this->_metadata["zip"]["compressed_size"];
}
+ /**
+ * returns the total uncompressed size of the files in the
package
+ *
+ * @return the size in bytes
+ */
function getUncompressedSize()
{
return $this->_metadata["zip"]["uncompressed_size"];
}
+ /**
+ * returns the total compressed size of this file, in a
nicer, human-readable format
+ *
+ * @return a string representing the uncompressed size
+ */
function getRoundedUncompressedSize()
{
return
StringUtils::formatSize($this->_metadata["zip"]["uncompressed_size"]);
}
+ /**
+ * @return returns the number of files in the package
+ */
function getTotalFiles()
{
return $this->_metadata["zip"]["entries_count"];
}
+ /**
+ * returns the compression method that was used to generate
this file
+ *
+ * @return a string representing the compression method
+ */
function getCompressionMethod()
{
return $this->_metadata["zip"]["copmression_method"];
}
+ /**
+ * returns the compression speed
+ *
+ * @return a string representing the compression speed
+ */
function getCompressionSpeed()
{
return $this->_metadata["zip"]["compression_speed"];
Modified: plog/trunk/class/gallery/galleryconstants.php
===================================================================
--- plog/trunk/class/gallery/galleryconstants.php 2005-03-15 17:58:47
UTC (rev 1513)
+++ plog/trunk/class/gallery/galleryconstants.php 2005-03-15 19:52:38
UTC (rev 1514)
@@ -1,11 +1,6 @@
<?php
/**
- * @package gallery
- */
-
-
- /**
* flags used to calculate what we can do with the image
*/
define( "GALLERY_RESOURCE_PREVIEW_AVAILABLE", 1 );
Modified: plog/trunk/class/gallery/getid3/getid3.lib.php
===================================================================
--- plog/trunk/class/gallery/getid3/getid3.lib.php 2005-03-15 17:58:47
UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/getid3.lib.php 2005-03-15 19:52:38
UTC (rev 1514)
@@ -53,8 +53,9 @@
define('GETID3_JPG_SOF15', "\xCF");
define('GETID3_JPG_EOI', "\xD9"); // End Of Image (end of datastream)
-
-
+/**
+ * \ingroup getid3
+ */
class getid3_lib
{
Modified: plog/trunk/class/gallery/getid3/getid3.php
===================================================================
--- plog/trunk/class/gallery/getid3/getid3.php 2005-03-15 17:58:47 UTC (rev
1513)
+++ plog/trunk/class/gallery/getid3/getid3.php 2005-03-15 19:52:38 UTC (rev
1514)
@@ -15,7 +15,11 @@
define('GETID3_FREAD_BUFFER_SIZE', 16384); // read buffer size in bytes
-
+/**
+ * \defgroup getid3
+ *
+ * Extracts information from supported files, such as metadata from images.
+ */
class getID3
{
// public: Settings
Modified: plog/trunk/class/gallery/getid3/module.archive.rar.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.archive.rar.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.archive.rar.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_rar
{
Modified: plog/trunk/class/gallery/getid3/module.archive.szip.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.archive.szip.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.archive.szip.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_szip
{
Modified: plog/trunk/class/gallery/getid3/module.archive.zip.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.archive.zip.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.archive.zip.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_zip
{
Modified: plog/trunk/class/gallery/getid3/module.audio-video.asf.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.asf.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.asf.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -23,7 +23,9 @@
}
-
+/**
+ * \ingroup getid3
+ */
class getid3_asf
{
Modified: plog/trunk/class/gallery/getid3/module.audio-video.bink.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.bink.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.bink.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_bink
{
Modified: plog/trunk/class/gallery/getid3/module.audio-video.matroska.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.matroska.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.matroska.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_matroska
{
Modified: plog/trunk/class/gallery/getid3/module.audio-video.mpeg.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.mpeg.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.mpeg.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -24,7 +24,9 @@
define('GETID3_MPEG_VIDEO_GROUP_START', "\x00\x00\x01\xB8");
define('GETID3_MPEG_AUDIO_START', "\x00\x00\x01\xC0");
-
+/**
+ * \ingroup getid3
+ */
class getid3_mpeg
{
Modified: plog/trunk/class/gallery/getid3/module.audio-video.nsv.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.nsv.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.nsv.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_nsv
{
Modified: plog/trunk/class/gallery/getid3/module.audio-video.quicktime.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.quicktime.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.quicktime.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -5,16 +5,18 @@
// or http://www.getid3.org //
/////////////////////////////////////////////////////////////////
// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.quicktime.php //
-// module for analyzing Quicktime and MP3-in-MP4 files //
-// dependencies: module.audio.mp3.php //
-// ///
-/////////////////////////////////////////////////////////////////
+
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php',
__FILE__, true);
-
+/**
+ * \ingroup getid3
+ *
+ * //
+ * module.audio-video.quicktime.php //
+ * module for analyzing Quicktime and MP3-in-MP4 files //
+ * dependencies: module.audio.mp3.php //
+ * ///
+*/
class getid3_quicktime
{
Modified: plog/trunk/class/gallery/getid3/module.audio-video.real.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.real.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.real.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -5,16 +5,16 @@
// or http://www.getid3.org //
/////////////////////////////////////////////////////////////////
// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.real.php //
-// module for analyzing Real Audio/Video files //
-// dependencies: module.audio-video.riff.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.ph
p', __FILE__, true);
+/**
+ * \ingroup getid3
+ * //
+ * module.audio-video.real.php //
+ * module for analyzing Real Audio/Video files //
+ * dependencies: module.audio-video.riff.php //
+ * ///
+*/
class getid3_real
{
Modified: plog/trunk/class/gallery/getid3/module.audio-video.riff.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.riff.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.riff.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -18,6 +18,9 @@
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php',
__FILE__, true);
+/**
+ * \ingroup getid3
+ */
class getid3_riff
{
@@ -922,7 +925,7 @@
'IMUS'=>'composer',
'INAM'=>'title',
'IPDS'=>'productiondesigner',
- 'IPLT'=>'palette',
+ 'IPLT'=>'palette',
'IPRD'=>'product',
'IPRO'=>'producer',
'IPRT'=>'part',
Modified: plog/trunk/class/gallery/getid3/module.audio-video.swf.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio-video.swf.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio-video.swf.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_swf
{
Modified: plog/trunk/class/gallery/getid3/module.audio.aac.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.aac.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.aac.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_aac
{
Modified: plog/trunk/class/gallery/getid3/module.audio.ac3.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.ac3.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.ac3.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_ac3
{
Modified: plog/trunk/class/gallery/getid3/module.audio.au.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.au.php 2005-03-15 17:58:47
UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.au.php 2005-03-15 19:52:38
UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_au
{
Modified: plog/trunk/class/gallery/getid3/module.audio.avr.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.avr.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.avr.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_avr
{
Modified: plog/trunk/class/gallery/getid3/module.audio.bonk.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.bonk.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.bonk.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_bonk
{
function getid3_bonk(&$fd, &$ThisFileInfo) {
Modified: plog/trunk/class/gallery/getid3/module.audio.flac.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.flac.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.flac.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -15,7 +15,9 @@
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php',
__FILE__, true);
-
+/**
+ * \ingroup getid3
+ */
class getid3_flac
{
Modified: plog/trunk/class/gallery/getid3/module.audio.la.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.la.php 2005-03-15 17:58:47
UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.la.php 2005-03-15 19:52:38
UTC (rev 1514)
@@ -15,6 +15,9 @@
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.ph
p', __FILE__, true);
+/**
+ * \ingroup getid3
+ */
class getid3_la
{
Modified: plog/trunk/class/gallery/getid3/module.audio.lpac.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.lpac.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.lpac.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -15,6 +15,9 @@
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.ph
p', __FILE__, true);
+/**
+ * \ingroup getid3
+ */
class getid3_lpac
{
Modified: plog/trunk/class/gallery/getid3/module.audio.midi.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.midi.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.midi.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_midi
{
Modified: plog/trunk/class/gallery/getid3/module.audio.mod.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.mod.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.mod.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_mod
{
Modified: plog/trunk/class/gallery/getid3/module.audio.monkey.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.monkey.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.monkey.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_monkey
{
Modified: plog/trunk/class/gallery/getid3/module.audio.mp3.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.mp3.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.mp3.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -20,7 +20,9 @@
// mpeg-audio streams
define('GETID3_MP3_VALID_CHECK_FRAMES', 35);
-
+/**
+ * \ingroup getid3
+ */
class getid3_mp3
{
Modified: plog/trunk/class/gallery/getid3/module.audio.mpc.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.mpc.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.mpc.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_mpc
{
Modified: plog/trunk/class/gallery/getid3/module.audio.ogg.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.ogg.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.ogg.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -15,6 +15,9 @@
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.flac.php',
__FILE__, true);
+/**
+ * \ingroup getid3
+ */
class getid3_ogg
{
Modified: plog/trunk/class/gallery/getid3/module.audio.optimfrog.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.optimfrog.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.optimfrog.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -15,6 +15,9 @@
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.ph
p', __FILE__, true);
+/**
+ * \ingroup getid3
+ */
class getid3_optimfrog
{
Modified: plog/trunk/class/gallery/getid3/module.audio.rkau.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.rkau.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.rkau.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_rkau
{
Modified: plog/trunk/class/gallery/getid3/module.audio.shorten.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.shorten.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.shorten.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_shorten
{
Modified: plog/trunk/class/gallery/getid3/module.audio.tta.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.tta.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.tta.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_tta
{
Modified: plog/trunk/class/gallery/getid3/module.audio.voc.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.voc.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.voc.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_voc
{
Modified: plog/trunk/class/gallery/getid3/module.audio.vqf.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.audio.vqf.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.audio.vqf.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_vqf
{
function getid3_vqf(&$fd, &$ThisFileInfo) {
Modified: plog/trunk/class/gallery/getid3/module.graphic.bmp.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.graphic.bmp.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.graphic.bmp.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_bmp
{
Modified: plog/trunk/class/gallery/getid3/module.graphic.gif.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.graphic.gif.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.graphic.gif.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_gif
{
Modified: plog/trunk/class/gallery/getid3/module.graphic.jpg.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.graphic.jpg.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.graphic.jpg.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_jpg
{
Modified: plog/trunk/class/gallery/getid3/module.graphic.pcd.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.graphic.pcd.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.graphic.pcd.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_pcd
{
function getid3_pcd(&$fd, &$ThisFileInfo, $ExtractData=0) {
Modified: plog/trunk/class/gallery/getid3/module.graphic.png.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.graphic.png.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.graphic.png.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_png
{
Modified: plog/trunk/class/gallery/getid3/module.misc.exe.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.misc.exe.php 2005-03-15 17:58:47
UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.misc.exe.php 2005-03-15 19:52:38
UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_exe
{
Modified: plog/trunk/class/gallery/getid3/module.misc.iso.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.misc.iso.php 2005-03-15 17:58:47
UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.misc.iso.php 2005-03-15 19:52:38
UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_iso
{
Modified: plog/trunk/class/gallery/getid3/module.tag.apetag.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.tag.apetag.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.tag.apetag.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,6 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
+/**
+ * \ingroup getid3
+ */
class getid3_apetag
{
Modified: plog/trunk/class/gallery/getid3/module.tag.id3v1.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.tag.id3v1.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.tag.id3v1.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_id3v1
{
Modified: plog/trunk/class/gallery/getid3/module.tag.id3v2.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.tag.id3v2.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.tag.id3v2.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -15,6 +15,9 @@
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php',
__FILE__, true);
+/**
+ * \ingroup getid3
+ */
class getid3_id3v2
{
Modified: plog/trunk/class/gallery/getid3/module.tag.lyrics3.php
===================================================================
--- plog/trunk/class/gallery/getid3/module.tag.lyrics3.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/getid3/module.tag.lyrics3.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -13,7 +13,9 @@
// ///
/////////////////////////////////////////////////////////////////
-
+/**
+ * \ingroup getid3
+ */
class getid3_lyrics3
{
Modified: plog/trunk/class/gallery/resizers/galleryabstractresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/galleryabstractresizer.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/resizers/galleryabstractresizer.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -3,11 +3,14 @@
include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
/**
+ * \ingroup Gallery_resizer
+ *
* Abstract class for generating thumbnails. It actually provides no
methods but only
* the skeleton of the functions that should be implemented by the
generators
* themselves.
*/
- class GalleryAbstractResizer extends Object {
+ class GalleryAbstractResizer extends Object
+ {
var $_image;
var $_outputMethod;
@@ -28,7 +31,8 @@
* Generates the thumbnail
* Uses the values set in the constructor regarding the width,
height and output format
*
- * @return Returns an Image object representing the file
+ * @return Returns a the path to the thumbnail that was generated,
or empty if error
+ * @see GalleryResizer::generate()
*/
function generate( $outFile, $width, $height )
{
Modified: plog/trunk/class/gallery/resizers/gallerygdresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/gallerygdresizer.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/resizers/gallerygdresizer.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -9,13 +9,16 @@
define( "GD_RESIZER_BICUBIC_MODE", 3 );
/**
- * Generates functions using the built-in GD library functionality.
+ * \ingroup Gallery_resizer
+ *
+ * Generates thumbnails using the built-in GD library functionality.
*
* Based off Shiege Iseng's (shiegege at yahoo.com) Resize Class found
somewhere in
* the net, but heavily modified specially concerning error situations.
*
*/
- class GalleryGDResizer extends GalleryAbstractResizer {
+ class GalleryGDResizer extends GalleryAbstractResizer
+ {
var $img;
@@ -24,6 +27,9 @@
$this->GalleryAbstractResizer( $image, $outputMethod );
}
+ /**
+ * @see GalleryResizer::generate
+ */
function generate( $outFile, $width, $height )
{
//
@@ -53,6 +59,9 @@
return $outFile;
}
+ /**
+ * @private
+ */
function thumbnail($imgfile)
{
//detect image format
@@ -95,6 +104,9 @@
return true;
}
+ /**
+ * @private
+ */
function size_height($size=100)
{
//height
@@ -110,6 +122,9 @@
return true;
}
+ /**
+ * @private
+ */
function size_width($size=100)
{
//width
@@ -124,7 +139,10 @@
return true;
}
-
+
+ /**
+ * @private
+ */
function size_auto($size=100)
{
//size
@@ -140,6 +158,9 @@
return true;
}
+ /**
+ * @private
+ */
function jpeg_quality($quality=75)
{
//jpeg quality
@@ -152,6 +173,8 @@
* returns true if gd2 is available or false otherwise.
* Based on a comment found in
http://fi2.php.net/imagecreatetruecolor by aaron at aaron-wright dot com
* (credit is due where it is due :)
+ *
+ * @return true if GD2 is available or false otherwise
*/
function isGD2Available()
{
@@ -255,6 +278,9 @@
}
}
+ /**
+ * @private
+ */
function save( $save = "" )
{
$fileParts = explode( ".", $save );
Modified:
plog/trunk/class/gallery/resizers/galleryimagemagickresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/galleryimagemagickresizer.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/resizers/galleryimagemagickresizer.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -2,11 +2,20 @@
include_once(
PLOG_CLASS_PATH."class/gallery/resizers/galleryabstractresizer.class.php" );
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
+
+ define( "DEFAULT_PATH_TO_CONVERT", "/usr/bin/convert" );
/**
- * Back end class for generating thumbnails with ImageMagick
+ *
+ * \ingroup Gallery_resizer
+ *
+ * Back end class for generating thumbnails with ImageMagick. It
requires the tool
+ * 'convert' to be installed somewhere in the filesystem. The exact
location is determined
+ * via the config setting "path_to_convert", but it will default to
<b>/usr/bin/convert</b>
+ * if the setting does not exist.
*/
- class GalleryImageMagickResizer extends GalleryAbstractResizer {
+ class GalleryImageMagickResizer extends GalleryAbstractResizer
+ {
/**
* Constructor.
@@ -16,11 +25,14 @@
$this->GalleryAbstractResizer( $image, $outputMethod );
}
+ /**
+ * @see GalleryResizer::generate
+ */
function generate( $outFile, $width, $height )
{
// get the path to the convert tool
$config =& Config::getConfig();
- $convertPath = $config->getValue( "path_to_convert" );
+ $convertPath = $config->getValue( "path_to_convert",
DEFAULT_PATH_TO_CONVERT );
// run the command
$command = $convertPath." -geometry ".$width."x".$height."
".$this->_image." ".$outFile;
Modified: plog/trunk/class/gallery/resizers/gallerynullresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/gallerynullresizer.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/resizers/gallerynullresizer.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -3,6 +3,8 @@
include_once(
PLOG_CLASS_PATH."class/gallery/resizers/galleryabstractresizer.class.php" );
/**
+ * \ingroup Gallery_resizer
+ *
* This class is a thumbnail generator that does not generate
thumbnails :) The purpose
* of it (it has to have one, right? :)) is that if none of the other
methods are
* available (gd, imagemagick) at least we can "simulate" thumbnails by
using the
@@ -10,7 +12,8 @@
* will not calculate the reduced image but simply return it as it...
Well, at least it'll
* be the fastest thumbnail method around ;)
*/
- class GalleryNullResizer extends GalleryAbstractResizer {
+ class GalleryNullResizer extends GalleryAbstractResizer
+ {
/**
* Constructor.
@@ -22,10 +25,7 @@
}
/**
- * Generates the thumbnail
- * Uses the values set in the constructor regarding the width,
height and output format
- *
- * @return Returns an Image object representing the file
+ * @see GalleryResizer::generate()
*/
function generate( $outFile, $width, $height )
{
Modified: plog/trunk/class/gallery/resizers/galleryresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/galleryresizer.class.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/resizers/galleryresizer.class.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -1,5 +1,24 @@
<?php
+ /**
+ * \defgroup Gallery_resizer
+ *
+ * Please use the proxy class GalleryResizer that should be used to
generate thumbnails, instead of using directly
+ * classes such as GalleryGdResizer or GalleryImageMagickResizer.
This class will check from the
+ * configuration the values of the parameters
<b>thumbnail_method</b> and <b>thumbnail_format</b>
+ * and load the appropiate thumbnail generator class.
+ *
+ * Example usage:
+ *
+ * <pre>
+ * $generator = new GalleryResizer( "/tmp/image.jpg" );
+ * if( $generator->generate( "/tmp/image_thum.jpg", 120, 120 ))
+ * print("Thumbnail generated ok!" );
+ * else
+ * print( "There was an error generating the thumbnail" );
+ * </pre>
+ */
+
include_once(
PLOG_CLASS_PATH."class/gallery/resizers/gallerynullresizer.class.php" );
include_once(
PLOG_CLASS_PATH."class/gallery/resizers/galleryimagemagickresizer.class.php"
);
include_once(
PLOG_CLASS_PATH."class/gallery/resizers/gallerygdresizer.class.php" );
@@ -12,15 +31,18 @@
define( "THUMBNAIL_OUTPUT_FORMAT_JPG", "jpg" );
define( "THUMBNAIL_OUTPUT_FORMAT_PNG", "png" );
define( "THUMBNAIL_OUTPUT_FORMAT_GIF", "gif" );
-
+
/**
+ * \ingroup Gallery_resizer
+ *
* Takes care of generating, storing and retrieving thumbnails.
*
* Supports several methods for the generation of thumbnails and can
support as
* many as needed. It also supports caching of thumbnails so that they
don't have
* to be generated after each request.
- */
- class GalleryResizer extends Object {
+ */
+ class GalleryResizer extends Object
+ {
/**
* This is the array used to know which are the supported
@@ -79,13 +101,13 @@
}
/**
- * returns the format that will be used/has been used to
generate a thumbnail, out of the
- * following values:
+ * returns the format that will be used/has been used to
generate a thumbnail.
*
- * THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE
- * THUMBNAIL_OUTPUT_FORMAT_JPG
- * THUMBNAIL_OUTPUT_FORMAT_PNG
- * THUMBNAIL_OUTPUT_FORMAT_GIF
+ * @return Returns one of:
+ * - THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE
+ * - THUMBNAIL_OUTPUT_FORMAT_JPG
+ * - THUMBNAIL_OUTPUT_FORMAT_PNG
+ * - THUMBNAIL_OUTPUT_FORMAT_GIF
*/
function getThumbnailFormat()
{
@@ -96,9 +118,12 @@
/**
* Generates a thumbnail.
*
+ * @param outFile
* @param width The width of the thumbnail
* @param height The height of the thumbnail
- * @return Returns...
+ * @param keepAspectRatio whether thumbnails should keep
their aspect ratio (even though the final size
+ * might be somehow bigger than the value of the
$height or $width parameter)
+ * @return the path to the thumbnail that was generated or empty if
error
*/
function generate( $outFile, $width = DEFAULT_THUMB_WIDTH, $height
= DEFAULT_THUMB_HEIGHT, $keepAspectRatio = true )
{
Modified: plog/trunk/class/gallery/resizers/gddetector.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/gddetector.class.php 2005-03-15
17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/resizers/gddetector.class.php 2005-03-15
19:52:38 UTC (rev 1514)
@@ -3,6 +3,8 @@
include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
/**
+ * \ingroup Gallery_resizer
+ *
* Implementes the detectGd method which returns true if the GD
library
* is available in this host
*
@@ -18,7 +20,7 @@
* Returns true if the GD library is available in this host,
or false
* otherwise.
*
- * @return Either true or false :)
+ * @return true if available or false otherwise
* @static
*/
function detectGd()
Modified: plog/trunk/class/gallery/template/gallerytemplatetools.class.php
===================================================================
--- plog/trunk/class/gallery/template/gallerytemplatetools.class.php
2005-03-15 17:58:47 UTC (rev 1513)
+++ plog/trunk/class/gallery/template/gallerytemplatetools.class.php
2005-03-15 19:52:38 UTC (rev 1514)
@@ -5,7 +5,9 @@
include_once(
PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
/**
- * some extra useful functions
+ * \ingroup Gallery
+ *
+ * some extra useful functions, which shouldn't be used by
developers anyway...
*/
class GalleryTemplateTools extends Object
{
_______________________________________________
pLog-svn mailing list
pLog-svn at devel.plogworld.net
http://devel.plogworld.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list