CWIS Developer Documentation
|
Encapsulates a full-size, preview, and thumbnail image. More...
Public Member Functions | |
__construct ($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... | |
LinkTarget ($NewValue=NULL) | |
Get or set the link target 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... | |
GetImageUrlForResource ($ResourceId, $FieldId, $Index, $Size) | |
Get the URL pointing to an image. 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... | |
static | ClearImageSymlinksForResource ($ResourceId, $FieldId) |
Remove symlinks used for to cache image mappings. More... | |
static | ClearImageSymlinks () |
Remove all symlinks used for a cached image mapping. More... | |
static | ExpireImageSymlinks () |
Expire old symlinks used for cached image mappings. More... | |
Public Attributes | |
const | CACHE_PATH = "local/data/caches/ImageLinks" |
path containg the symlinks mapping images/fields to resources More... | |
const | SIZE_FULL = 3 |
const | SIZE_PREVIEW = 2 |
const | SIZE_THUMBNAIL = 1 |
Encapsulates a full-size, preview, and thumbnail image.
Definition at line 13 of file SPTImage.php.
SPTImage::__construct | ( | $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.
mixed | $ImageIdOrFileNameOrImageObj | Image ID, image file name, or SPTImage. |
int | $MaxWidth | Maximum width of the full-size image. |
int | $MaxHeight | Maximum height of the full-size image. |
int | $MaxPreviewWidth | Maximum width of the preview image. |
int | $MaxPreviewHeight | Maximum height of the preview image. |
int | $MaxThumbnailWidth | Maximum width of the thumbnail image. |
int | $MaxThumbnailHeight | Maximum height of the thumbnail image. |
Definition at line 37 of file SPTImage.php.
SPTImage::AltText | ( | $NewValue = NULL | ) |
Get or set the alternate text value for the image.
string | $NewValue | New alternate text value. This parameter is optional. |
Definition at line 284 of file SPTImage.php.
References Id().
Referenced by ExpireImageSymlinks().
|
static |
Check that the image storage directories are available, creating them and attempting to change their permissions if possible.
Definition at line 353 of file SPTImage.php.
|
static |
Remove all symlinks used for a cached image mapping.
Definition at line 601 of file SPTImage.php.
|
static |
Remove symlinks used for to cache image mappings.
int | $ResourceId | Source resource. |
int | $FieldId | Source field. |
Definition at line 576 of file SPTImage.php.
References StdLib\CheckMyCaller().
Referenced by Resource\Clear(), and Resource\Set().
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 324 of file SPTImage.php.
References Id().
|
static |
Expire old symlinks used for cached image mappings.
Definition at line 621 of file SPTImage.php.
References AI_FILEUNREADABLE, AI_INTERNALERROR, AI_OKAY, AltText(), Image\Extension(), Format(), Height(), Id(), LinkTarget(), PreviewHeight(), PreviewWidth(), Image\Status(), ThumbnailHeight(), ThumbnailWidth(), and Width().
SPTImage::Format | ( | ) |
Get the format of the image.
The value will be one IMGTYPE_* constants from the Image class.
Definition at line 137 of file SPTImage.php.
Referenced by ExpireImageSymlinks(), and GetImageUrlForResource().
SPTImage::GetImageUrlForResource | ( | $ResourceId, | |
$FieldId, | |||
$Index, | |||
$Size | |||
) |
Get the URL pointing to an image.
int | $ResourceId | Source resource. |
int | $FieldId | Source field. |
int | $Index | Image number w/in this field. |
int | $Size | Image size as an SPTImage::SIZE_ const. |
Definition at line 508 of file SPTImage.php.
References StdLib\CheckMyCaller(), Image\Extension(), and Format().
SPTImage::GetLink | ( | ) |
Get the path to the full-size image.
Definition at line 273 of file SPTImage.php.
SPTImage::Height | ( | ) |
Get the height of the image.
Definition at line 156 of file SPTImage.php.
Referenced by ExpireImageSymlinks(), and Resize().
SPTImage::Id | ( | ) |
Get the ID of the image in the database.
Definition at line 82 of file SPTImage.php.
Referenced by AltText(), Delete(), ExpireImageSymlinks(), and LinkTarget().
|
static |
Get the path to the (full-size) image storage directory.
Definition at line 210 of file SPTImage.php.
SPTImage::LinkTarget | ( | $NewValue = NULL | ) |
Get or set the link target value for the image.
string | $NewValue | New value for link target (OPTIONAL) |
Definition at line 307 of file SPTImage.php.
References Id().
Referenced by ExpireImageSymlinks().
SPTImage::Mimetype | ( | ) |
Get the MIME type for the image.
Definition at line 146 of file SPTImage.php.
SPTImage::PreviewHeight | ( | ) |
Get the height of the preview image for this image.
Definition at line 174 of file SPTImage.php.
Referenced by ExpireImageSymlinks(), and Resize().
|
static |
Get the path to the preview image storage directory.
Definition at line 231 of file SPTImage.php.
SPTImage::PreviewUrl | ( | ) |
Get the path to the preview image for this image.
Definition at line 106 of file SPTImage.php.
SPTImage::PreviewWidth | ( | ) |
Get the width of the preview image for this image.
Definition at line 183 of file SPTImage.php.
Referenced by ExpireImageSymlinks(), and Resize().
SPTImage::Resize | ( | $MaxWidth, | |
$MaxHeight, | |||
$MaxPreviewWidth, | |||
$MaxPreviewHeight, | |||
$MaxThumbnailWidth, | |||
$MaxThumbnailHeight | |||
) |
Resize the full-size, preview, and thumbnail images based on the given dimension restrictions.
int | $MaxWidth | Maximum width of the full-size image. |
int | $MaxHeight | Maximum height of the full-size image. |
int | $MaxPreviewWidth | Maximum width of the preview image. |
int | $MaxPreviewHeight | Maximum height of the preview image. |
int | $MaxThumbnailWidth | Maximum width of the thumbnail image. |
int | $MaxThumbnailHeight | Maximum height of the thumbnail image. |
Definition at line 440 of file SPTImage.php.
References Height(), PreviewHeight(), PreviewWidth(), ThumbnailHeight(), ThumbnailWidth(), and Width().
SPTImage::Status | ( | ) |
Get the error status set by the constructor.
Definition at line 343 of file SPTImage.php.
SPTImage::ThumbnailHeight | ( | ) |
Get the height of the thumbnail image for this image.
Definition at line 192 of file SPTImage.php.
Referenced by ExpireImageSymlinks(), and Resize().
|
static |
Get the path to the thumbnail image storage directory.
Definition at line 252 of file SPTImage.php.
SPTImage::ThumbnailUrl | ( | ) |
Get the path to the thumbnail image for this image.
Definition at line 121 of file SPTImage.php.
SPTImage::ThumbnailWidth | ( | ) |
Get the width of the thumbnail image for this image.
Definition at line 201 of file SPTImage.php.
Referenced by ExpireImageSymlinks(), and Resize().
SPTImage::Url | ( | ) |
Get the path to the image.
Definition at line 91 of file SPTImage.php.
SPTImage::Width | ( | ) |
Get the width of the image.
Definition at line 165 of file SPTImage.php.
Referenced by ExpireImageSymlinks(), and Resize().
const SPTImage::CACHE_PATH = "local/data/caches/ImageLinks" |
path containg the symlinks mapping images/fields to resources
Definition at line 19 of file SPTImage.php.
const SPTImage::SIZE_FULL = 3 |
Definition at line 21 of file SPTImage.php.
const SPTImage::SIZE_PREVIEW = 2 |
Definition at line 22 of file SPTImage.php.
const SPTImage::SIZE_THUMBNAIL = 1 |
Definition at line 23 of file SPTImage.php.