Documentation
SAP Hybris ImageEngine Integration
First, sign up for an ImageEngine account with 60 days free trial. Once you have configured your trial you will receive a Deliver Address. The delivery address can be a generic one, or a CNAME alias of your choice.
In the following example, if your current domain is example.com
, then Hybris stores images in images.example.com
. When setting up your ImageEngine Account, you would configure the images.example.com
as the Delivery Address.
# Getting Started
# 1. Override Hybris’ Basic Media URL strategy
To override Hybris’ out-of-the-box media URL strategy and replace with one configured for ImageEngine, download the ImageEngineUrlStrategy.java class from Github to your project’s core extension. If you already have a custom URL strategy, then please contact our support team for guidance on how to proceed.
Make sure its package and folder path look like the following examples:
- Class package:
com.imageengine.media.url.impl.ImageEngineUrlStrategy
- Folder path will be like:
/trainingcore/src/com/imageengine/media/url /impl/ImageEngineUrlStrategy.java
# 2. Define Bean For The Override Strategy
Go to your core extension’s resource folder. Find and edit *core-spring.xml
to add the below bean definition that references the new imageEngineURL strategy:
<bean id="imageEngineUrlStrategy" class="com.imageengine.media.url.impl.ImageEngineUrlStrategy" parent="localMediaWebURLStrategy"/>
Make sure above in the class attribute you have given a correct class package path.
# 3. Configure Your local.properties File
Find your local.properties
in ${HYBRIS_HOME}/hybris/config/local.properties
Add the below properties to local.properties
. They will point your image media URL to ImageEngine CDN for image media. Use the images.example.com
hostname that your configures during your ImageEngine account or trial setup on the second line.
media.folder.images.url.strategy = imageEngineUrlStrategy
media.folder.images.hostname = https://images.example.com
# 4. Build and Test the Changes
Open your Terminal
# Go to the Hybris platform dir
cd ${HYBRIS_HOME}/hybris/bin/platform
# Setup and run ant (for Linux, run "./setantenv.sh")
setantenv.bat
ant clean all
# Start the hybris server (for Linux, run "./hybrisserver.sh")
hybrisserver.bat
Open the home page in your browser and see the rendered image URL. When you inspect the image, It should point to the hostname URL which you have configured in local.properties
For example, a home page image tree.jpg
would have an image URL of images.example.com/tree.jpg
.