Hybrid Assets module
Edition |
Incubator (services) |
||
Issues |
|||
Git |
|||
Latest |
2.0.14
|
The Hybrid Assets module lets you store your asset metadata in the Magnolia DAM JCR implementation, but store the actual asset content outside of Magnolia in an external content store.
Hybrid assets are suited to:
-
very large assets, such as video or large images, that may not be easily stored in the JCR DAM
-
storing asset content in outside of Magnolia in a store that does not support full asset metadata, such as the Amazon S3 Connector module
-
external storage that cannot support the full DAM API
-
acting as a federated DAM with all asset entities and their metadata stored in one place while asset content is spread over storage locations and sources, including the Magnolia JCR DAM itself
The Hybrid Assets module can transfer asset content between several external storage locations and the Magnolia JCR DAM and import assets from external storage into the JCR DAM.
|
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency>
<groupId>info.magnolia.assets</groupId>
<artifactId>magnolia-hybrid-assets-app</artifactId>
<version>2.0.14</version>
</dependency>
Basic functions:
-
create
-
edit
-
delete
Configuration for mapping to S3 bucket: Replace CONFIGUREBUCKET with your bucket name
referenceFactory:
class: info.magnolia.dam.hybrid.mapping.SimpleReferenceFactory
mappings:
referenceS3:
class: info.magnolia.dam.hybrid.mapping.TransformReferenceMapping
referenceTemplate: s3://CONFIGUREBUCKET/${baseName}-${nodeId}-${timestamp}.${extension}
voters:
mgnlDam:
class: info.magnolia.dam.hybrid.voters.NodeWorkspaceVoter
stores:
storeS3:
class: info.magnolia.dam.hybrid.store.S3AssetStore
description: S3 asset store
useExternalLinks: false
useExternalLinksInAuthor: false
#externalDomain: https://domain.com
<dependency>
<groupId>info.magnolia.assets</groupId>
<artifactId>magnolia-hybrid-assets-advanced</artifactId>
<version>2.0.14</version>
</dependency>
Advanced functions:
Function | Description |
---|---|
Link external content |
Create hybrid asset(s) linked to content in an external content store. |
Export content |
Transfers content from an existing asset to a designated location in an external content store. |
Import external content |
Transfers hybrid asset content stored in an external content store back into the Magnolia JCR DAM. |
Refresh external content |
Updates hybrid asset to force any stored images (like thumbnails) to be updated. This is particularly useful when the linked external content has been updated. |
<dependency>
<groupId>info.magnolia.assets</groupId>
<artifactId>magnolia-hybrid-assets-img-recognition</artifactId>
<version>2.0.14</version>
</dependency>
Image Recognition Compatibility:
This module is required if using the image Recogntion module https://docs.magnolia-cms.com/product-docs/6.2/Modules/List-of-modules/Image-Recognition-module.html
<dependency>
<groupId>info.magnolia.assets</groupId>
<artifactId>magnolia-hybrid-assets</artifactId>
<version>1.0</version>
</dependency>
Usage
Extensions to the Assets app
The Hybrid Asset module adds workbench actions to the Assets app:
Function | Description |
---|---|
Link external content |
Create hybrid asset(s) linked to content in an external content store. |
Export content |
Transfers content from an existing asset to a designated location in an external content store. |
Import external content |
Transfers hybrid asset content stored in an external content store back into the Magnolia JCR DAM. |
Refresh external content |
Updates hybrid asset to force any stored images (like thumbnails) to be updated. This is particularly useful when the linked external content has been updated. |
Linking to external content
The Hybrid Assets module can do more than just exporting asset content outside of Magnolia. It can also use the Extended S3 connector to browse Amazon S3 storage using different credentials and create hybrid assets from content already residing outside of Magnolia.
Hybrid assets under the hood
Storing asset content outside of Magnolia with hybrid assets is controlled by two configurable components: the reference factory and one or more external content stores. The reference factory determines where the content for an asset will be stored and the content stores handle the storing and retrieving of content outside of Magnolia.
Reference factory
The hybrid asset reference factory determines where the content of a hybrid asset will be stored. The reference factory can choose different locations for the content of an asset based on:
-
the JCR workspace of the asset
-
the path of the asset
-
the value of an asset property
-
the mime type of an asset
You can define multiple "mappings" in the reference factory. Each mapping defines a template for the destination of the asset content and voters that will determine if the mapping will be used to generate the destination of the content for a given asset
See External reference factory for more on configuring the reference factory and mappings. |
External content stores
External content stores simply store asset content outside of Magnolia and allows hybrid assets to read and write their content. You define external content stores as part of your Hybrid Asset module configuration.
An external content must be configured with:
-
access credentials for the external store
-
specify what content the content store will read and write
See External content stores for more on configuring the content stores. |
Image recognition
AWS has a size limitation for the image recognition service, in order to send big files to this service, the image recognition for hybrid assets provides a default configurable variation to resize the images over 5MB before sending them to the service. This value can be overridden decorating the module configuration with a new value, resizeWidth: 1024
.
You can disable image recognition by setting in the configuration enabled: false
and set a max size value to prevent the procesing of big images maxSize: 5000000
.
damLinkField with Hybrid asset
To properly display asset information on the form when using damLinkField with a Hybrid asset, the class info.magnolia.dam.hybrid.field.HybridItemPreviewComponent
should be included in the YAML configuration.
form:
properties:
image:
$type: damLinkField
preview:
class: info.magnolia.ui.editor.ItemPreviewDefinition
implementationClass: info.magnolia.dam.hybrid.field.HybridItemPreviewComponent
Versioning with S3 asset
Hybrid asset support you to effectively manage assets with versioning. You first need to enable versioning in the specific bucket where your assets are stored.
External Domain
This configuration allows to stream data directly form the external store. This is a preview feature that depends on the fastly-proxy module.
-
useExternalLinks: false
-
useExternalLinksInAuthor: false
-
externalDomain: https://domain.com