Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
   eZ Publish 4.x / legacy

eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Skip to end of metadata
Go to start of metadata

5.4 / 2014.09

IO URL decoration

By default, images and binary files referenced by content will be served from the same server than the application, like /var/ezdemo_site/storage/images/3/6/4/6/6463-1-eng-GB/kidding.png. This is the default semantic configuration:

 $var_dir$ and $storage_dir$ are dynamic, siteaccess aware settings, and will be replaced by those settings value in the execution context.


URL decorators are an eZ Publish 5 features. If an image field is displayed via a legacy callback or legacy template, no decoration will be applied.

Using a static server for images

One common use-case is to use an optimized nginx to serve images in an optimized way. The example image above could be made available as, by setting up a server that uses ezpublish/ezpublish_legacy/var/ezdemo_site/storage. The eZ Publish configuration would be as follows:

Legacy compatibility

Legacy still requires non absolute path to store images (var/site/storage/images...). In order to work around this, a UrlRedecorator, that converts back and forth between the legacy uri prefix and the one in use in the application, has been added. It is used in all places where a legacy URL is returned/expected, and takes care of making sure the value is as expected.


Any BinaryFile returned by the public API is prefixed with the value of this setting, internally stored as

Dynamic container settings


Default value: $var_dir$/$storage_dir$
Example: /var/ezdemo_site/storage

Used to configure the default URL decorator service (, used by all binarydata handlers to generate the URI of loaded files. It is always interpreted as an absolute URI, meaning that unless it contains a scheme (http://, ftp://), it will be prepended with a '/'.

Note that the admin interface and front-end sites in legacy_mode won't display images with the URL configured in io.url_prefix.

This setting is siteaccess-aware.


url decorators

An UrlDecorator decorates and undecorates a given string (url) in some way. It has two mirror methods: decorate and undecorate.

Two implementations are provided: Prefix, and AbsolutePrefix. They both add a prefix to an URL, but AbsolutePrefix will ensure that unless the prefix is an external URL, the result will be prepended with /.

Three UrlDecorator services are introduced:

  • Used by the binarydata handlers to decorate all uris sent out by the API. Uses AbsolutePrefix.
  • Used via the UrlRedecorator (see below) by various legacy elements (Converter, Storage Gateway...) to generate its internal storage format for uris. Uses a Prefix, not an AbsolutePrefix, meaning that no leading / is added.

In addition, an UrlRedecorator service,, uses both decorators abive to convert URIs between what is used on the new stack, and what format legacy expects (relative urls from the ezpublish root).