Gentics CMS GenticsImageStore

The GenticsImageStore is a feature that can be used to embed resized images in pages and overviews.

JPEG CMYK images are supported by the GenticsImageStore. However, because a generic CMYK color profile is used, the image colors might change slightly after the image was manipulated.

1 Usage



<img src="/GenticsImageStore/<node width>/auto/prop/<node bild>">

1.1 Resize modes

Parameter Description
width Image width
height Image height
mode Resizing Mode
imageurl Image url

The following modes are available:

  • prop used for proportional resizing. The aspect ratio of the image will be preserved. When target width and height do not match the original image proportions, the lower value (height, width) will be used for resizing.
  • force used for forced resizing. The aspect ratio of the original image will not be preserved when this mode is used. If the original aspect ratio of the image is different than the resized aspect ratio, the image will be distorted.
  • smart used for automatic resizing and cropping of images.

1.2 Crop and resize mode

Available after Gentics Portal.Node Update 11432 2011-06-01

Additionally the special ‘cropandresize’ mode can be used to crop images.



Name Description
width Image width
height Image height
mode Resizing Mode (see prop,force,smart)
topleft_x Start X coordinate of the image area (from the top left corner)
topleft_y Start Y coordinate of the image area (from the top left corner)
cropwidth Image area width
cropheight Image area height
imageurl Imageurl

1.3 Degree of compression

The compression value for JPEG is a value from 0.0 (max compression) to 1.0 (min compression). By default this value is set to 0.9 and can be configured inside your node.conf like following:


2 Gentics CMS

2.1 Render Directive

To include a resized image into a velocity tag, this should be done with the directive #gtx_gis.

<img src='#gtx_gis($image, $resize)'>

or, when cropping shall be done:

<img src='#gtx_gis($image, $resize, $crop)'>

The $image may be an image from the same or from another node.

2.1.1 Parameters
Name Description Usage example
$image Either the image (as object) or the image ID $
$resize Resize options {"width": 50, "mode": "smart"}
$crop Crop options {"x": 10, "y": 10, "width": 30, "height": 30}
2.1.2 Resize options
Name Description Default value
width Image width “auto”
height Image height “auto”
mode Resizing mode (“prop”, “force”, “smart”, “fpsmart”) “prop”
type Type of the rendering (“url”, “phpwidget”) “url”

width and height must not both be set to “auto”.

The mode “fpsmart” is like “smart”, but it requires both width and height to be set and it takes the focal point of the image into account when cropping. “fpsmart” is only available in the render directive, not in the GenticsImageStore itself. The directive will convert “fpsmart” into a “cropandresize” operation. See Using Focal Point with GenticsImageStore for details.

2.1.3 Cropping options
Name Description Default value
x Start X coordinate of the image area (from the top left corner) 0
y Start Y coordinate of the image area (from the top left corner) 0
width Cropping width
height Cropping height
2.1.4 Usage examples

The following example assumes, that the tag has a part img of type URL (Image):

#set($image = $
<img src='#gtx_gis($image, {"width": 100, "height": 100, "mode": "prop"})'>

It is also possible, to define the resizing parameters in a separate variable (which can be reused in the template):

#set($image = $
#set($resize = {"width": 50, "mode": "smart"})##
<img src='#gtx_gis($image, $resize)'>

Additionally, when cropping shall be done, the cropping parameters have to be passed as (optional) third parameter:

#set($image = $
#set($resize = {"width": 50, "mode": "smart"})##
#set($crop = {"x": 10, "y": 10, "width": 30, "height": 30})##
<img src='#gtx_gis($image, $resize, $crop)'>

When publishing pages for Gentics Portal.Node PHP, you should set the type to “phpwidget” in the resize options. It will render a PHP widget that resizes the image.

2.2 Static Cross Node Projects

When using the directive #gtx_gis(), the URLs will already be rendered correctly, even in the image is contained in a foreign node. The following description applies only, if not using the directive #gtx_gis().

The GenticsImageStore is also able to resize images in foreign nodes. A page in node A may contain the following image url:


Such an url will be identified by the GenticsImageStore during the publish process. The GenticsImageStore identifies the referenced node by examining the hostname within the found url. The image within node B will be resized when the GenticsImageStore determines that the referenced node (in this case node b) is publishing into the file system. Resizing will otherwise be omitted.

The image tag must be adapted to include the node B hostname.

Example velocity implementation:

velocity example

#set( $nodePath = "$")
#set( $pubdir = "$")
#set( $imagePath = "$")

## Remove the trailing slash from the pub_dir
#set( $pubdir = $pubdir.trim())
#set( $len = $cms.imps.velocitytools.math.sub($pubdir.length(),1) ) 
#set( $pubdir = $pubdir.substring(0, $len))

## Remove the trailing slash from the nodePath
#set( $nodePath = $nodePath.trim())
#set( $len = $cms.imps.velocitytools.math.sub($nodePath.length(),1) ) 
#set( $nodePath = $nodePath.substring(0, $len))

<img  src="http://${}/GenticsImageStore/300/auto/prop${nodePath}${pubdir}/${imagePath}"/>
<img src="/GenticsImageStore/300/auto/prop/$" />

2.3 Publishing

Resized images will be written to the file system when the GenticsImageStore was used within the project. The usage will be determined by examining the final page content. All GenticsImageStore URLs will be processed. The GenticsImageStore will invoke the resizing of a page when the GenticsImageStore finds a resize call within a published page. The resized image will be written to a folder called GenticsImageStore within the pub directory of that particular node. Please note that this directory has to be synced with the target webserver as well.

2.4 Restricting parallel resize requests

Requests to the CMS for resizing images might consume large amounts of memory. If too many requests are handled at the same time, this might even cause OutOfMemory situations. Therefore, the maximum number of actual resize operations is per default limited to 10.

This can be configured in the CMS configuration files:



When this setting is changed, the CMS Tomcat must be restarted.

3 Servlet Parameters

The GenticsImageStore can be used within Portal implementations. The configuration is performed using the following servlet parameters.

3.1 cacheKeyQueryParameters

Available after Gentics Portal.Node Update 11432 2011-06-01

This parameter can be used to modify the internally used cache key for cached images. It is possible to specify certain get parameters. These parameters will then be used (if available) to enhance the cache.key. Normally all other query parameters will not be used for generating the cache key. The parameters can be specified in a comma-separated list. This parameter is useful when the images will be retrieved using a servlet that uses query parameters to identify the image that should be loaded.



3.2 portalBasePath

Available after Gentics Portal.Node Update 11432 2011-06-01

The portal base path is used to identify the image url within a GenticsImageStore url. The default value is “/Portal.Node”. The used prefix can be adapted using this parameter. This is useful of images will not be delivered by Portal.Node.


3.3 portalBasePathRegEx

Available after Gentics Portal.Node Update Update 11779 2011-11-29

This parameter has the same functionality as the portalBasePath. It is possible to configure multiple basepaths by using a regular expression. When set, this parameter has priority over portalBasePath.


3.4 urlPrefix

By default the image will be loaded from the host that received the initial GenticsImageStore request. The urlPrefix setting can be used when the image should be loaded from a different host.


3.5 uriMapper

An addition to the uriPrefix is the uriMapper parameter. This parameter allows specifying a custom implementation that is able to modify the image uri. It is therefore possible to customize the uri according to set uri parameters or hostnames.

To achieve this, one has to implement the interface com.gentics.api.imagestore.ImageUriMapper. The name of the implemented class has to be set as value for the “uriMapper” parameter. Please note that the full package name has to be specified. The implemented class must be able to be loaded by the Servlet ClassLoader.


public interface ImageUriMapper {

	 * Maps a request for an image to an URI where the image can be fetched from.
	 * This method should have no side effects and should always return the same URI
	 * for the given imageUri and the parameters in the given servletRequest.
	 * Further, this method should be idempotent such that passing back the returned URI
	 * to this method again returns the given URI unchanged.
	 * @param servletRequest
	 * 		  The request that fetches the image.
	 * @param imageUri
	 * 		  The URI of the image to fetch.
	 * @return
	 * 		  May either return the given URI unchanged, or an alternate URI
	 * 		  where the image will be fetched from instead.

	URI mapImageUri(HttpServletRequest servletRequest, URI imageUri);



3.6 Request Decorators

This parameter allows a custom implementation to be specified that will intercept requests to the GenticsImageStore and modify them as desired.

For this to be done, an implementation of the interface com.gentics.api.imagestore.RequestDecorator has to be specified in the configuration. The name of the implemented class (including the full package name) has to be set as value for the “requestDecorator” parameter. As with the uriMapper, the implemented class must be able to be loaded by the Servlet ClassLoader.


public interface RequestDecorator {
	 * Provides the ability to alter parameters of requests sent to the GenticsImageStore
	 * @param gisRequest
	 * 		  The GenticsImageStoreRequest Bean containing request information
	 * @param request
	 * 		  The HttpServletRequest object containing request information
	void decorateRequest(GenticsImageStoreRequest gisRequest, HttpServletRequest request);


For use in Gentics CMS, the RequestDecorator class must be configured in the node.conf with the variable $GIS_REQUEST_DECORATOR, for example:


	$GIS_REQUEST_DECORATOR = "com.example.RequestDecoratorImpl";

3.7 loadTimeout

This parameter defines the timeout used for loading the original image for resizing in milliseconds. The default is 60000 ms (= 1 minute).


4 Caching

The GenticsImageStore uses the JCS Cache which can be configured using the cache.ccf file.

Example Cache Region Configuration: