ImageModel
Model for assets of type 'picture.'. For common website usage images have cropping informations for different aspect-ratios and sizes. With these informations the Dynamic Image Cache offers variants as configured in presets. The ImageModel provides access to this stuctured variants by genericKey to select an preset. If no aspect-ratio is provided in preset use model as method to select an aspect-ratio. If it is necessary to access the original image data you can do so by the plain key. In outdated versions these 'image-variants' were created by the censhare server as an asset-structure and were accessed similar.
implements: hash, method
bundle: standard information structure (sismodel)
since 5.2.0
Model for assets of type 'picture.'.
For common website usage images have cropping informations for different aspect-ratios and sizes. With these informations the Dynamic Image Cache offers variants as configured in presets.
The ImageModel provides access to this stuctured variants by '→genericKey' to select an preset.
If no aspect-ratio is provided in preset '→use model as method' to select an aspect-ratio.
If it is necessary to access the original image data you can do so by the '→plain' key.
In outdated versions these 'image-variants' were created by the censhare server as an asset-structure and were accessed similar.
Model for assets where type attribute value starts with 'picture.'.
Defined hash keys
<String:genericKey> ↦ ImageModel | Image
since 5.2.0
case 1: if the current ImageModel(this) is legacy image-variant:
Test if the genericKey is contained in configured storage item short keys and derive a new ImageModel pointing to that variant.
case 2: if the current ImageModel(this) is not legacy image-variant or derived by '→plain':
Test if genericKey matches a storage-items key of the image-asset, derive a Image pointing to the storage. case 3: otherwise test if genericKey matches a presets and derive an Image.
- Example:
'anyImageModel.plain.master.src' -> (with genericKey='master') returns a URL usable as src for the image in storage item 'master'
'anyImageModel.xxl.src' -> (with genericKey='xxl') returns a URL usable as src for the image in storage-item/short-key/preset 'xxl' of the variant with the default aspect ratio.
alt ↦ String
since 5.2.0
get text of alt attribute. only available if created from xml-source (like article content)
exif ↦ ExifDataModel
since 5.2.0
get exif data
hasLock.<String:hashKey> ↦ Boolean
since 5.2.0
Check if the value accessed by the hash-key 'hashKey' within this model is secured by an active lock by permission rights management
- Example:
model.hasLock.elem - is elem in model guarded by an active permission lock?
article.hasLock.text - Returns if there is a permission lock for text configured in 'article' ? (In this example 'article' is of of type ArticleModel)
hasVariants ↦ Boolean
since 5.2.0
Does this image has transformation variants?
iptc ↦ IptcDataModel
since 5.2.0
get IPTC data
isLocked.<String:hashKey> ↦ Boolean
since 5.2.0
Check if the value accessed by the hash-key 'hashKey' within this model is is locked for current user by permission rights management
- Example:
model.isLocked.elem -- is value for elem in model locked for current logged-in user?
article.isLocked.text -- Returns if the value for 'text' within 'article' is locked (not accessible) for current user. (In this example 'article' is of of type ArticleModel)
isMasterStorageAvailable ↦ Boolean
since 5.5.0
true if StorageItemModel 'master' exists
isUseMasterFile ↦ Boolean
since 2017.5.4
true
isVariant ↦ Boolean
since 5.2.0
Is this image a transformation variant?
permissionGroups ↦ sequence<PermissionGroupAssetModel| PermissionGroupAssetFeatureModel>
since 5.2.0
get values of feature 'censhare:module.oc.permission.group' | 'censhare:module.oc.permission.group-ref'
plain ↦ ImageModel
since 5.2.0
switch mode to plain access; allows to create download URLs
- Example:
imageModel.plain.storageFoo.persistentSrc - persistent URl of image file
price ↦ Number
since 5.2.0
get value of feature 'censhare:price'
title ↦ String
since 5.2.0
get title of image, only available if created from xml-source (like article content)
Delegates other keys to: Image
Permission Verbs used
image.alt
since 5.2.0 'image.alt' - guards requests to '→alt'
image.permissionGroups
since 5.2.0 'image.permissionGroups' - guards requests to '→permissionGroups'
image.title
since 5.2.0 'image.title' - guards requests to '→title'
picture.exif
since 5.2.0 'picture.exif' - guards requests to '→exif'
picture.hasVariants
since 5.2.0 'picture.hasVariants' - guards requests to '→hasVariants'
picture.iptc
since 5.2.0 'picture.iptc' - guards requests to '→iptc'
picture.isMasterStorageItemAvailable
since 5.5.0 'picture.isMasterStorageItemAvailable' - guards requests to '→isMasterStorageAvailable'
picture.isUseMasterFileAvailable
since 2017.5.4 'picture.isUseMasterFileAvailable' - guards requests to '→isUseMasterFile'
picture.isVariant
since 5.2.0 'picture.isVariant' - guards requests to '→isVariant'
picture.plain
since 5.2.0 'picture.plain' - guards requests to '→plain'
picture.price
since 5.2.0 'picture.price' - guards requests to '→price'
Methods
[used as method](String:aspect-ratio) ↦ ImageModel
since 5.2.0
Get a model for image variant with given aspect-ratio
- Example:
image('16-9').foo.src - Get url for this image's variant with ratio '16-9' from storage with key 'foo'. ('image' is an instance of ImageModel)