Call to a member function transformDimensions() on null in Drupal\blazy\Media\BlazyImage::transformDimensions()

Created on 31 July 2024, 4 months ago
Updated 25 August 2024, 3 months ago

Problem/Motivation

The latest version of elevatezoomplus and the latest version of splide breaks the page with this error,

Error: Call to a member function transformDimensions() on null in Drupal\blazy\Media\BlazyImage::transformDimensions() (line 444 of /home/public_html/modules/contrib/blazy/src/Media/BlazyImage.php).

This issue does not appear with Slick Carousel but appears with Splide.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇳🇬Nigeria chike Nigeria

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @chike
  • @chike,
    I am unable to reproduce the error. Could you please provide steps to reproduce?

  • 🇳🇬Nigeria chike Nigeria

    Using Drupal core 10.3.1 and Barrio B5 theme install Drupal commerce, add images field on a product or product variation, format the field to display with Splide Image, use Grid Foundation for Skin main, X Grid for Optionset main, choose an image style, then add Media switcher "Image to Elevatezoomplus" with Default optionset.

    Trying viewing a product you will see the error.

    I have also seen this with a different theme based on Bootstrap 4 and running Drupal 9.

  • Status changed to Postponed: needs info 4 months ago
  • 🇮🇩Indonesia gausarts

    Thank you.

    Please paste half of error message to track the caller down better.

    Please also fill in Image style option.

  • 🇮🇩Indonesia gausarts

    Also fill in Lightbox image style and Lightbox media style options for just in case.

  • 🇳🇬Nigeria chike Nigeria

    Screenshot of formatter form:

    Backtrace (when trying to view a product):

    The website encountered an unexpected error. Try again later.
    
    Error: Call to a member function transformDimensions() on null in Drupal\blazy\Media\BlazyImage::transformDimensions() (line 444 of modules/contrib/blazy/src/Media/BlazyImage.php).
    Drupal\blazy\Blazy::transformDimensions() (Line: 81)
    elevatezoomplus_build() (Line: 42)
    template_preprocess_elevatezoomplus()
    call_user_func_array() (Line: 261)
    Drupal\Core\Theme\ThemeManager->render() (Line: 491)
    Drupal\Core\Render\Renderer->doRender() (Line: 248)
    Drupal\Core\Render\Renderer->render() (Line: 475)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 61)
    __TwigTemplate_ff4c80800399fc79d4ccb6c3cb72253b->doDisplay() (Line: 360)
    Twig\Template->yield() (Line: 335)
    Twig\Template->render() (Line: 38)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 491)
    Drupal\Core\Render\Renderer->doRender() (Line: 248)
    Drupal\Core\Render\Renderer->render() (Line: 238)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 231)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
    call_user_func() (Line: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
  • 🇮🇩Indonesia gausarts

    These image styles should be provided for now:

    • Image style
    • Lightbox image style
    • Lightbox media style (if using media)
    • Thumbnail style

    See project home under Image styles section.

  • 🇮🇩Indonesia gausarts

    For Media switcher, try changing to anything other than Image to Elevatezoom Plus.

    Image to Elevatezoom Plus is normally for GridStack or Blazy grid formatters, not Slick/Splide

    See project home again:

    Important!
    If using Splide/ Slick with asNavFor, you can choose any lightbox.
    If not, just a static stage, be sure to choose Image to ElevateZoomPlus
    to sync the main preview and its thumbnails.

  • 🇳🇬Nigeria chike Nigeria

    Really my bad.

    Adding the image styles fixed the issue.

    I usually would add the image styles but I was quickly setting up the page to fine tune later.

    Sorry about the trouble and thanks for helping out.

    Do you know because of this issue I had to use Colorbox on a different site I had this issue some weeks ago. That was nodes and not product but this issue appeared and to move on I installed Colorbox and used it.

  • 🇮🇩Indonesia gausarts

    No problems. Glad you did it :)

    Let's keep this open as Bug till fixes.
    This error shouldn't happen, anyway.

    Patches are welcome.

  • 🇩🇪Germany Anybody Porta Westfalica
    • gausarts committed e1e01330 on 2.0.x
      Issue #3465019 by chike, ananya.k: Call to a member function...
  • Status changed to Fixed 3 months ago
  • 🇮🇩Indonesia gausarts

    Thank you for contribution.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024