2020-12-27 03:55

Disable Lazy load of Image if the image has lazyLoad attribute

  • Export a site containing image component using .export.zip method

  • Extract the downloaded zip and open the .html file in your browser

  • Observe that the images are not displayed in the site even though they are present in the exported zip folder

  • Site Image links are written in a temporary path '/var/designs/' and written in the site before exporting the site and have a lazy Load disable attribute set in them

  • Page Exporter exports the images of the site in /var/designs/ directory in the zip

  • Image js again rewrites the links and thus breaking the img element upon page load

  • Don't rewrite the links upon page load if the image doesn't allow lazy load

  • CQ-4241179

| Q                       | A | ------------------------ | --- | Fixed Issues? | CQ-4241179 | Patch: Bug Fix? | | Minor: New Feature? | | Major: Breaking Change? | | Tests Added + Pass? | | Documentation Provided | Yes (code comments and or markdown) | Any Dependency Changes? | | License | Apache License, Version 2.0


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • weixin_39761573 weixin_39761573 3月前

    , : closing this as this is not the proper fix and there was no answer to previous comment describing recommended alternatives.

    点赞 评论 复制链接分享
  • weixin_39761573 weixin_39761573 3月前

    I'm not sure what you're trying to do. It seems that you are trying to disable smart loading of images. That happens automatically when lazy loading is disabled and there's only one allowed image width.

    Lazy loading means deferring image load to when it enters the viewport, it's only one aspect of smart loading.

    Like I said before, ideally you would also rewrite the data-cmp-src attribute from the exporter. If that is not possible I think you could force a disablement of smart loading by removing the data-cmp-lazy and reducing image width to only the exported image (via data-cmp-widths).

    I think there's no need to introduce a new attribute that is only used by the exporter.

    点赞 评论 复制链接分享
  • weixin_39778003 weixin_39778003 3月前

    i have updated the implementation to check for the attribute rather than a path. Could you please review it again ?

    点赞 评论 复制链接分享
  • weixin_39995439 weixin_39995439 3月前

    Codecov Report

    Merging #287 into master will not change coverage. The diff coverage is n/a.

    Impacted file tree graph

    @@           Coverage Diff            @@
    ##             master    #287   +/-   ##
      Coverage      82.4%   82.4%           
      Complexity      795     795           
      Files            73      73           
      Lines          2581    2581           
      Branches        471     471           
      Hits           2127    2127           
      Misses          187     187           
      Partials        267     267

    Continue to review full report at Codecov.

    Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0eb46f1...06287a2. Read the comment docs.

    点赞 评论 复制链接分享
  • weixin_39761573 weixin_39761573 3月前

    I think a better solution would be to update the exporter to rewrite the data-cmp-src as well or disable the smart image size loading completely.

    点赞 评论 复制链接分享
  • weixin_39778003 weixin_39778003 3月前

    could you please review

    点赞 评论 复制链接分享