Gentics CMS Image Import

This page will explain the usage of the image import feature.

1 Overview

The media image import/file fetch feature can be used to connect Gentics CMS to a thirdparty media asset system (eg. Celum). It enables Gentics CMS to load images from a media database system or any other external source.

Once the file fetch feature is activated you will see a new menu entry in the top menu New and additionally the image tag part will now also show a button which will open the media database system. Both locations will open the configured url and a new image may be downloaded if desired. The user will be directed to the media database interface where the user may select an image. Finally the media database system is responsible to redirect the user to the provided callback url. The Gentics CMS Server will download the image after the media database has send the download request using the callback url. The image will be saved in the current folder or the parent folder of the page which is currently being edited.

In older versions of Gentics CMS this feature was also known as media database feature.

2 Configuration

2.1 Basic Configuration

By enabling the feature the image import feature gets activated. The menu entry and button will show up if no additional settings like FILE_FETCH_PER_NODE_URL or FILE_FETCH_PER_NODE_PERMISSION are set.


  $FEATURE["file_fetch"] = true; 

This URL will be passed to the media database so that the media database system may invoke a postback to the CMS system. The query parameter: “sid=$sid&do=15005” must be included. The URL itself must be in the correct format so that the media database server can access the cms server with that url.


  $FILE_FETCH_POSTBACK_URL = "http://localhost/.Node?sid=$sid&do=15005";

The url to the media database. This url will be opened in a new window once the image import button gets pressed. The “postback” parameter may be selected freely. The media database server must be able to read this parameter and perform a postback uppon that url.



The media database system can invoke the postback request uppon the FILE_FETCH_POSTBACK_URL once a image was selected by the user. The postback request must include a Query of Post parameter that contains the download url for the image. The parameter name can be specified by the FILE_FETCH_PARAM setting.


  $FILE_FETCH_PARAM = "download"; 

This variable must be set to true. This variable is used for backwards compatibility.



2.2 Upload Folder

The file fetch feature will use the default image folder which can be specified using the node properties dialog. The parent folder of page will be used when no default upload folder for images was specified. Please note that the media import button will be hidden when the user has insufficant permissions to upload into the default image folder or the parent folder of the page from which the tag was accessed.

2.3 Custom File Fetch URLs

It is also possible to configure a different filefetch url per node.

The image import feature will be disabled for nodes that have no filefetch url when the FILE_FETCH_URL was not set. The FILE_FETCH_URL setting will be used as a default value for all nodes that have no specific url when it is available. In that case the feature will be enabled.


  $FILE_FETCH_PER_NODE_URL[1] = "http://...";

2.4 Custom Node Group Permission Mapping

It is possible to create a group/node whitelist. This is useful if you want to restrict the image import feature for a set of users in different nodes.

  • Create one or more permission groups within the Gentics CMS system.
  • You can now add any user you want to one of these groups.
  • Finally you can create a mapping for the created groups. The mapping in the node.conf will specify which group is allowed to use the image import feature. The users in those groups will only see the image import feature (Button and menuentry) when their mapping reveals that they are assigned to the node in which they are working.



  // Group 7 is allowed to use the image import feature for node 1,2,3 and 4.
  $FILE_FETCH_PER_NODE_PERMISSION[7] = array(1,2,3,4);
  // Group 123 is allowed to use the image import feature for node 2.

2.5 Handling Of Modified Files

The file_fetch_create_copy_for_modified_files feature will create copies for files that have been modified. Normally any media database image import will be omitted when the system detects that a file with the same name already exists in the folder in which the image should be imported. You can change the behaviour by enabling this feature.

When the system detects that you are about to import a file with the same name a check will be performed. Any file import action will be omitted when the system detects that both files have the same checksum. On the other hand the filename will be renamed once a modification of the imported file is detected.

This means that a media database import which was invoked though the image tag part media import button will only affect the tag that is beeing edited. All other tags are not affected since the previously selected image file was not changed in any way.


  $FEATURE['file_fetch_create_copy_for_modified_files']= true;

3 Celum Example:


  $FEATURE["file_fetch"] = true;
  $FILE_FETCH_POSTBACK_URL = "$sid&do=15005";
  $FILE_FETCH_PARAM = "src";
  $FILE_FETCH_URL = "$sid&authenticatorPath=/auth/check_session.php&successPath=celum/callback.php&logoutPath=celum/logout.php&successRedirectPath=/celum/callback.php?sid=$sid&postback=".urlencode($FILE_FETCH_POSTBACK_URL)."&passthru=".urlencode($FILE_FETCH_POSTBACK_URL);


  // src contains the celum image url 
     $src = $_POST['src'];
  } elseif(isset($_GET['src'])){
     $src = $_GET['src'];

  // We need to handle both source since celum provides the name in different
  // locations (When cropping the image you need to fetch the name from 
  // GET instead from POST).
  if(isset($_POST['name'])) {
    $filename = $_POST['name'];
  } elseif(isset($_GET['name'])) {
    $filename = $_GET['name'];

  // Strip the extension from the filename
  $path_parts = pathinfo($filename);
  $filename_without_extension = $path_parts['filename'];

  $src  = '' . $src; 
  $src .= '&filename=' .urlencode($filename_without_extension) ;

  $src = urlencode($src);

  $passthru = $_GET['passthru'];
  $url = $passthru .  '&src=' . $src;

$DEBUG = false;
if( $DEBUG ) {
  echo "<pre>";
    echo $url;
  echo "</pre>";
} else {
  header('Location: ' . $url);