Details
-
Bug
-
Resolution: Fixed
-
Medium
-
None
-
4.0.6, 4.0.7, 4.1.3, 4.1.4, 4.2.0
-
None
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
Issue Links
- is duplicated by
-
EZP-15773 Infinite loop in ImageManager when using filters from multiple image handlers
- Closed