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

Performance of ez_image_alias twig function

    XMLWordPrintable

    Details

    • Sprint:
      Candidates for next sprint

      Description

      Since 6.13.4 and this pull request (https://github.com/ezsystems/ezpublish-kernel/pull/2325) I determined some problems with ez_image_alias:

      In case that only the uri of an image alias is used in a template but not the height or width or any other variation information the twig function ez_image_alias can be very unperformant as it loads the corresponding binary file (ImagineAwareAliasGenerator.php(85)).
      Imagine there is a slider or gallery which uses srcset/sizes attributes: This leads to many calls of ez_image_alias and can result in an error (PHP Fatal error: Uncaught ImagickException: cache resources exhausted).

      Apart from implementing a custom twig function which only returns the uri of a variation the much consistent solution - in my opinion - would be to call ez_image_alias with a parameter. This parameter could take one or a list of particular variation properties like "uri", "fileName", "imageId" or "mimeType". In class ImagineAwareAliasGenerator it could be checked if it is necessary to load the variation file for returning the wanted properties or if it isn't necessary.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              holgermarx Holger Marx
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: