Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-15740

Current imagemanager can`t execute image aliases that have different image handler`s filters.

    XMLWordPrintable

Details

    Description

      Current imagemanager can`t execute image aliases which consist of different image handler`s filters. If you try to create this kind of image alias, your pages will be looped.

      It happens because, when image manager selects next image handler, only MIME Types are compared (aliase`s output MIME Type and MIME Type suported by current image handler). But number of supported filters to current handler is ignored.

      foreach ( $handlers as $handler ) {
      
      	...
      
      	$outputMimeData = $handler->outputMIMEType( $this, $currentMimeData, $destinationMimeData, $this->SupportedFormats, $aliasName );
      
      	if ( $outputMimeData['name'] == $destinationMimeData['name'] )
      
      	{
      
      		$nextMimeData = $outputMimeData;
      
      		$nextHandler = $handler;
      
      		break;
      
      	}
      
      	...
      
      }
      
      
      
      
      

      For examlpe we have created new image handler nxcimagehandler. After this we have created new image alias my_imagealias which consist of 2 filters:

      • ezimagegdhandler_filter1 (from ezimagegdhandler, its important that current filter doesn`t change MIME Type of image);
      • nxcimagehandler_filter2 (from nxcimagehandler);

      In this case, first time for $nextHandler will be assigned ezimagegdhandler. Filter ezimagegdhandler_filter1 will be applied to the image. And it will be removed from list of all filters which must be applied to the image.

      ...
      
      $handlerFilters = array();
      
      $leftoverFilters = array();
      
      foreach ( $filters as $filter )
      
      {
      
          if ( $nextHandler->isFilterSupported( $filter ) )
      
              $handlerFilters[] = $filter;
      
          else
      
              $leftoverFilters[] = $filter;
      
      }
      
      ...
      
      ...
      
      ...
      
      $filters = $leftoverFilters;
      
      ...
      
      
      

      But second time for $nextHandler will be assigned ezimagegdhandler too! Because $destinationMimeData['name'] didn`t change after executing ezimagegdhandler_filter1.

      Third time for $nextHandler will be assigned ezimagegdhandler too ... And here the looping is coming . nxcimagehandler_filter2 will be never applied.

      To avoid this lopping trouble with several filters of different image handers you need to apply current patch.

      Attachments

        Activity

          People

            gl gl
            a29ca475-2ac3-469b-95ea-e37ca79eae29@accounts.ibexa.co Sergiy Pushchin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: