CWIS Developer Documentation
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SPTImage Class Reference

Encapsulates a full-size, preview, and thumbnail image. More...

Public Member Functions

 SPTImage ($ImageIdOrFileNameOrImageObj, $MaxWidth=NULL, $MaxHeight=NULL, $MaxPreviewWidth=NULL, $MaxPreviewHeight=NULL, $MaxThumbnailWidth=NULL, $MaxThumbnailHeight=NULL)
 Object constructor. More...
 
 Id ()
 Get the ID of the image in the database. More...
 
 Url ()
 Get the path to the image. More...
 
 PreviewUrl ()
 Get the path to the preview image for this image. More...
 
 ThumbnailUrl ()
 Get the path to the thumbnail image for this image. More...
 
 Format ()
 Get the format of the image. More...
 
 Mimetype ()
 Get the MIME type for the image. More...
 
 Height ()
 Get the height of the image. More...
 
 Width ()
 Get the width of the image. More...
 
 PreviewHeight ()
 Get the height of the preview image for this image. More...
 
 PreviewWidth ()
 Get the width of the preview image for this image. More...
 
 ThumbnailHeight ()
 Get the height of the thumbnail image for this image. More...
 
 ThumbnailWidth ()
 Get the width of the thumbnail image for this image. More...
 
 GetLink ()
 Get the path to the full-size image. More...
 
 AltText ($NewValue=NULL)
 Get or set the alternate text value for the image. More...
 
 Delete ()
 Delete the image, that is, remove its record from the database and delete the associated image files from the file system. More...
 
 Status ()
 Get the error status set by the constructor. More...
 
 Resize ($MaxWidth, $MaxHeight, $MaxPreviewWidth, $MaxPreviewHeight, $MaxThumbnailWidth, $MaxThumbnailHeight)
 Resize the full-size, preview, and thumbnail images based on the given dimension restrictions. More...
 

Static Public Member Functions

static ImageStorageDirectory ()
 Get the path to the (full-size) image storage directory. More...
 
static PreviewStorageDirectory ()
 Get the path to the preview image storage directory. More...
 
static ThumbnailStorageDirectory ()
 Get the path to the thumbnail image storage directory. More...
 
static CheckDirectories ()
 Check that the image storage directories are available, creating them and attempting to change their permissions if possible. More...
 

Public Attributes

const IMAGE_PATH = "ImageStorage/"
 base path where images are stored More...
 
const PREVIEW_PATH = "ImageStorage/Previews/"
 path where preview images are stored More...
 
const THUMBNAIL_PATH = "ImageStorage/Thumbnails/"
 path where thumbnail images are stored More...
 

Detailed Description

Encapsulates a full-size, preview, and thumbnail image.

Definition at line 13 of file SPTImage.php.

Member Function Documentation

SPTImage::AltText (   $NewValue = NULL)

Get or set the alternate text value for the image.

Parameters
string$NewValueNew alternate text value. This parameter is optional.
Returns
Returns the current alternate text value.

Definition at line 256 of file SPTImage.php.

References Id().

static SPTImage::CheckDirectories ( )
static

Check that the image storage directories are available, creating them and attempting to change their permissions if possible.

Returns
Returns an array of error codes or NULL if no errors are found.

Definition at line 307 of file SPTImage.php.

SPTImage::Delete ( )

Delete the image, that is, remove its record from the database and delete the associated image files from the file system.

Definition at line 278 of file SPTImage.php.

References Id().

SPTImage::Format ( )

Get the format of the image.

The value will be one IMGTYPE_* constants from the Image class.

Returns
Returns the format of the image.

Definition at line 133 of file SPTImage.php.

SPTImage::GetLink ( )

Get the path to the full-size image.

Returns
Returns the path to the full-size image.

Definition at line 248 of file SPTImage.php.

SPTImage::Height ( )

Get the height of the image.

Returns
Returns the height of the image.

Definition at line 149 of file SPTImage.php.

Referenced by Resize().

Here is the caller graph for this function:

SPTImage::Id ( )

Get the ID of the image in the database.

Returns
Returns the ID of the image in the database.

Definition at line 81 of file SPTImage.php.

Referenced by AltText(), and Delete().

Here is the caller graph for this function:

static SPTImage::ImageStorageDirectory ( )
static

Get the path to the (full-size) image storage directory.

Returns
Returns the path to the full-size image storage directory.

Definition at line 185 of file SPTImage.php.

SPTImage::Mimetype ( )

Get the MIME type for the image.

Returns
Returns the MIME type for the image.

Definition at line 139 of file SPTImage.php.

SPTImage::PreviewHeight ( )

Get the height of the preview image for this image.

Returns
Returns the height of the preview image for this image.

Definition at line 161 of file SPTImage.php.

Referenced by Resize().

Here is the caller graph for this function:

static SPTImage::PreviewStorageDirectory ( )
static

Get the path to the preview image storage directory.

Returns
Returns the path to the preview image storage directory.

Definition at line 206 of file SPTImage.php.

SPTImage::PreviewUrl ( )

Get the path to the preview image for this image.

Returns
Returns the path to the preview image for this image.

Definition at line 102 of file SPTImage.php.

SPTImage::PreviewWidth ( )

Get the width of the preview image for this image.

Returns
Returns the width of the preview image for this image.

Definition at line 167 of file SPTImage.php.

Referenced by Resize().

Here is the caller graph for this function:

SPTImage::Resize (   $MaxWidth,
  $MaxHeight,
  $MaxPreviewWidth,
  $MaxPreviewHeight,
  $MaxThumbnailWidth,
  $MaxThumbnailHeight 
)

Resize the full-size, preview, and thumbnail images based on the given dimension restrictions.

Parameters
int$MaxWidthMaximum width of the full-size image.
int$MaxHeightMaximum height of the full-size image.
int$MaxPreviewWidthMaximum width of the preview image.
int$MaxPreviewHeightMaximum height of the preview image.
int$MaxThumbnailWidthMaximum width of the thumbnail image.
int$MaxThumbnailHeightMaximum height of the thumbnail image.

Definition at line 394 of file SPTImage.php.

References Height(), PreviewHeight(), PreviewWidth(), ThumbnailHeight(), ThumbnailWidth(), and Width().

SPTImage::SPTImage (   $ImageIdOrFileNameOrImageObj,
  $MaxWidth = NULL,
  $MaxHeight = NULL,
  $MaxPreviewWidth = NULL,
  $MaxPreviewHeight = NULL,
  $MaxThumbnailWidth = NULL,
  $MaxThumbnailHeight = NULL 
)

Object constructor.

This loads an image if an ID is given or copies an image if either an SPTImage object or file path are passed in.

Parameters
mixed$ImageIdOrFileNameOrImageObjImage ID, image file name, or SPTImage.
int$MaxWidthMaximum width of the full-size image.
int$MaxHeightMaximum height of the full-size image.
int$MaxPreviewWidthMaximum width of the preview image.
int$MaxPreviewHeightMaximum height of the preview image.
int$MaxThumbnailWidthMaximum width of the thumbnail image.
int$MaxThumbnailHeightMaximum height of the thumbnail image.

Definition at line 36 of file SPTImage.php.

SPTImage::Status ( )

Get the error status set by the constructor.

Returns
Returns the error status set by the constructor.

Definition at line 297 of file SPTImage.php.

SPTImage::ThumbnailHeight ( )

Get the height of the thumbnail image for this image.

Returns
Returns the height of the thumbnail image for this image.

Definition at line 173 of file SPTImage.php.

Referenced by Resize().

Here is the caller graph for this function:

static SPTImage::ThumbnailStorageDirectory ( )
static

Get the path to the thumbnail image storage directory.

Returns
Returns the path to the thumbnail image storage directory.

Definition at line 227 of file SPTImage.php.

SPTImage::ThumbnailUrl ( )

Get the path to the thumbnail image for this image.

Returns
Returns the path to the thumbnail image for this image.

Definition at line 117 of file SPTImage.php.

SPTImage::ThumbnailWidth ( )

Get the width of the thumbnail image for this image.

Returns
Returns the width of the thumbnail image for this image.

Definition at line 179 of file SPTImage.php.

Referenced by Resize().

Here is the caller graph for this function:

SPTImage::Url ( )

Get the path to the image.

Returns
Returns the path to the image.

Definition at line 87 of file SPTImage.php.

SPTImage::Width ( )

Get the width of the image.

Returns
Returns the width of the image.

Definition at line 155 of file SPTImage.php.

Referenced by Resize().

Here is the caller graph for this function:

Member Data Documentation

const SPTImage::IMAGE_PATH = "ImageStorage/"

base path where images are stored

Definition at line 18 of file SPTImage.php.

const SPTImage::PREVIEW_PATH = "ImageStorage/Previews/"

path where preview images are stored

Definition at line 20 of file SPTImage.php.

const SPTImage::THUMBNAIL_PATH = "ImageStorage/Thumbnails/"

path where thumbnail images are stored

Definition at line 22 of file SPTImage.php.


The documentation for this class was generated from the following file: