Class siriux_photos_Photo

Description

Photo class

Located in /net/siriux/photos/Photo.php (line 21)


	
			
Variable Summary
 mixed $article
 mixed $datamanager
 mixed $errstr
 mixed $fullscale
 mixed $thumbnail
 mixed $view
 mixed $_config
 mixed $_l10n
Method Summary
 siriux_photos_Photo siriux_photos_Photo ([int $id = FALSE], [midcom_helper_configuration $config = null], [MidgardTopic $topic = null])
 TRUE approve ()
 true create_from_datamanager (string $filename, realname $realname)
 bool delete ()
 void get (mixed $id)
 void get_by_guid (mixed $guid)
 GUID guid ()
 void index ()
 void load_notes ()
 void rebuildThumbs ()
 void rereadExif ()
 void rotate (int $degrees)
 void save_notes (mixed $notes)
 void syncArticleCreated ([mixed $autoindex = true])
 TRUE unapprove ()
 true, _checkForResize (string $filename, int $width, int $height)
 void _generateImages (string $filename, string $name)
 bool _getExifData ([string $file = FALSE])
 void _getExifDataJhead (string $file)
 void _getExifDataPHP (string $tmpfile)
 void _getExifDataTimestamp (string $tmpfile)
 GUID _resizeAndStoreImage (string $filename, int $width, int $height, string $attname)
 GUID _storeImageAttachment (string $filename_disk, string $filename_att)
 bool _updateImageAttachment (string $filename_disk, MidgardAttachmenbt $attobj)
 string _writeAttachmentTmpFile (mixed $attachment, mixed $guid)
Variables
mixed $article (line 28)
mixed $datamanager (line 27)
mixed $errstr (line 34)
mixed $fullscale (line 30)
mixed $thumbnail (line 32)
mixed $view (line 31)
mixed $_config (line 23)
mixed $_l10n (line 24)
mixed $_l10n_midcom (line 25)
Methods
Constructor siriux_photos_Photo (line 49)

Creates a new instance and get Photo by id

If $config is set, the component context is ignored. Configuration is used directly, and the L10n libs are fetched from MidCOM.

siriux_photos_Photo siriux_photos_Photo ([int $id = FALSE], [midcom_helper_configuration $config = null], [MidgardTopic $topic = null])
  • MidgardTopic $topic: can be used for overriding the current gallery topic, defaults to MIDCOM_CONTEXT_CONTENTTOPIC
  • int $id: id (opt.)
  • midcom_helper_configuration $config: An explicit configuration, required for usage outside of the normal component context. Can be left empty normally.
approve (line 1066)

Approve the Photo using the Metadata framework.

This is a backwards compatibility function and should no longer be used.

  • return: on success, FALSE else
  • deprecated: Use the metadata framework instead.
TRUE approve ()
create_from_datamanager (line 229)

Creates a new photo based on a midcom datamanager driven form.

see the admin class for the big picture.

You should be aware, that this method will use a different schema then the upload form, as the upload form is a subset of the real data schema. This is especially important for the bulk upload feature.

  • return: on success, false otherwise, with an error in errstr.
true create_from_datamanager (string $filename, realname $realname)
  • string $filename: filename The full temporary filename of the uploaded file.
  • realname $realname: realname The real name of the uploaded file.
delete (line 1013)

Deletes the current Photo article and all its attachments

  • return: true if successful, FALSE otherwise
bool delete ()
get (line 118)

Gets a Photo by id or by object

void get (mixed $id)
  • mixed $id: id The ID or MidgardArticle object to use.
get_by_guid (line 204)

Gets a Photo by GUID

void get_by_guid (mixed $guid)
guid (line 1053)

Returns the GUID of the current Photo article

  • return: of the current Photo article
GUID guid ()
index (line 1194)

Indexes the article if the MidCOM indexer is enabled, otherwise, this is a null operation.

It will override the abstract automatically generated by the datamanager prepending it with an img link to the thumbnail.

As a side effect, it will invalidate the content cache modules related to this photo.

void index ()
load_notes (line 1223)

Loads the XML-formatted notes as-is

void load_notes ()
rebuildThumbs (line 1147)

This function will regenerate view and thumbnail images of the current Photo.

void rebuildThumbs ()
rereadExif (line 716)

This function rereads the EXIF data accociated with this image.

Any data currently set will be overwritten.

If no image is set (e.g. empty or not loaded article), this function will fail silently.

void rereadExif ()
rotate (line 1094)

Rotate the view and thumbnail image.

This does *not* affect the original image.

Any error will trigger an immediate error page.

void rotate (int $degrees)
  • int $degrees: The amount in degrees the image should be rotated clockwise, negative amounts possible.
save_notes (line 1245)

Stores the XML-formatted notes as-is

TODO: Parse the XML into data? or at least index it

void save_notes (mixed $notes)
syncArticleCreated (line 696)

This function synchronizes the article created timestamp with the value entered in the URL field, which holds the EXIF taken timestamp.

Synchronization is only done, if that timestamp is non-zero.

void syncArticleCreated ([mixed $autoindex = true])
unapprove (line 1080)

Unapprove the Photo using the metadata framework

This is a backwards compatibility function and should no longer be used.

  • return: on success, FALSE else
  • deprecated: Use the metadata framework instead.
TRUE unapprove ()
_checkForResize (line 563)

Checks, if you need to resize the image file no meet the constraints of the image. If the image can't be recognized by getimagesize, the function will always return true to force an imagemagic conversion attempt.

  • return: if the image need to be rescaled
true, _checkForResize (string $filename, int $width, int $height)
  • string $filename: filename The full name of the file to be checked.
  • int $width: width The maximum width
  • int $height: height The maximum height
_generateImages (line 362)

Generatres the preview and thumbnail JPEG image attachements.

void _generateImages (string $filename, string $name)
  • string $filename: filename The file on-disk to use
  • string $name: name The name to use for creating the attachment.
_getExifData (line 757)

Gets EXIF data from the fullscale image and stores it in the Photo Article using the mapping configured in the component.

The corresponding configuration value is of the form exiftag:dmfieldname. It supports only parameters as storage, so if you write "FNumber:fnumber" it will take the value of the EXIF Tag "FNumber" and store it in the parameter "data_fnumber" in the Domain "midcom.helper.datamanager". You can then define a field in the datamanager namend "fnumber" with the storage location "parameter", and the DM will be able to work with it.

The configuration key may have multiple, comma-separated pairs.

Note, that the taken value, part of the default schema and stored in the URL field of the record, will automatically be populated with the timestamp stored in FileDateTime EXIF Tag.

This function requires the EXIF Functions of PHP available. (read_exif_data).

  • return: Indicating success.
bool _getExifData ([string $file = FALSE])
  • string $file: file Filename of file on disk (opt.). If it is omitted, the attachment will be written to a temporary file so that the various handler functions can work with it.
_getExifDataJhead (line 888)

This is the JHead Version of the EXIF Extractor.

Safe to use prior to PHP 4.2.0

It does not support the exif mapping feature, only the taken timestamp is extracted here.

void _getExifDataJhead (string $file)
  • string $file: file The file from which to get the EXIF data.
_getExifDataPHP (line 941)

This is the PHP Version of the EXIF Extractor.

Safe to use as of PHP 4.2.0

void _getExifDataPHP (string $tmpfile)
  • string $tmpfile: tmpfile The file from which to get the EXIF data.
_getExifDataTimestamp (line 870)

This is the absolute Fallback in case no EXIF Readers are available. It uses the current Timestamp as a value.

Note, that since this only works during upload, not later, the function will not overwrite any value already in place.

Always safe.

It does not support the exif mapping feature, only the taken timestamp is extracted here.

void _getExifDataTimestamp (string $tmpfile)
  • string $tmpfile: file The file from which to get the EXIF data.
_resizeAndStoreImage (line 592)

Scales the image in the Attachment to match the given constraints and store ist as $attname on the current article.

Images will be postprocessed with imagemagick using these scaling filters: -unsharp 1x5 -modulate 100,110,100 -gamma 0.95

  • return: of the created attachment on success, false on failure.
GUID _resizeAndStoreImage (string $filename, int $width, int $height, string $attname)
  • string $filename: filename The full name of the file to be checked.
  • int $width: width The maximum width
  • int $height: height The maximum height
  • string $attname: attname The name of the attachment to create.
_storeImageAttachment (line 413)

General helper, that stores an image file as attachment and sets size parameters size.x, size.y, size.bytes, size.mimetype

  • return: of new attachment if successful, FALSE otherwise
GUID _storeImageAttachment (string $filename_disk, string $filename_att)
  • string $filename_disk: filename_disk Filename on disk (absolute path)
  • string $filename_att: filename_att Filename of attachment
_storeImageGuids (line 617)

Stores the image GUIDs to the extra2 field of the current article.

They will be separated by pipes and in the order fullscale, view, thumbnail.

  • return: on success, false otherwise.
true _storeImageGuids ()
_updateImageAttachment (line 496)

General helper, that updates an image file in an existing attachment and resets size parameters size.x, size.y, size.bytes, size.mimetype

  • return: Indicating success
bool _updateImageAttachment (string $filename_disk, MidgardAttachmenbt $attobj)
  • string $filename_disk: filename_disk Filename on disk (absolute path)
  • MidgardAttachmenbt $attobj: att_obj The attachment to update
_writeAttachmentTmpFile (line 654)

Writes a copy of an image to a temporary file for processing with tools like EXIF-Reader or imagemagick.

The callee is responsible for unlinking the file after usage.

  • return: filename
string _writeAttachmentTmpFile (mixed $attachment, mixed $guid)
  • mixed $guid: The Guid of the image to write out, defaults to the fullscale file. A string is interpreted as a GUID, alternativly you can pass a MidgardAttachment object.
_writeFullscaleFile (line 639)

Writes a copy of the original image to a temporary file for processing with tools like EXIF-Reader or imagemagick.

The callee is responsible for unlinking the file after usage.

This is a wrapper for writeAttachmentTmpFile().

  • return: filename
  • see: siriux_photos_Photo::writeAttachmentTmpFile()
string _writeFullscaleFile ()

Documentation generated on Mon, 21 Nov 2005 18:20:58 +0100 by phpDocumentor 1.3.0RC3