Scenario

A Drupal 7 site with Image Field Focus (https://www.drupal.org/project/imagefield_focus) and Lazy modules enabled.

Problem

When the user creates a new node and uploads an image. There is a Javascript error and the Image Field Focus module stop working.

The error is in the behavior programmed in the lazy.js file. I don't know why, but the `settings.lazy` object is null. So, when it tries to access to `settings.lazy.bLazy` object, an error is raised.

Solution

Check the existence of `settings.lazy` before using it.

Comments

unstatu created an issue. See original summary.

unstatu’s picture

Status: Active » Needs review
StatusFileSize
new431 bytes
Anonymous’s picture

Thank you, this patch solved my issue with lazy and imagefield crop: https://www.drupal.org/project/imagefield_crop.

Ievgen Antonovych’s picture

@unstatu added changes to apply patch correctly

unstatu’s picture

Great! If you have tried it maybe you can set the RTBC status?

bkhandruk’s picture

Status: Needs review » Reviewed & tested by the community

Works for me.

Thanks @ievgen-antonovych.

  • osman committed f1c1c27 on 7.x-1.x
    Issue #3016695: Javascript error when uploading an image
    
osman’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Assigned: unstatu » Unassigned
Status: Reviewed & tested by the community » Fixed

Hi, thank you all for your contribution.

The issue is now resolved in 7.x-1.x-dev indirectly, by matching the same settings structure to 8.x-2.x.

Important:
Module settings are now available at Drupal.settings.lazy instead of Drupal.settings.lazy.bLazy.

If you have an implementation on your theme or module javascript, targeting the old settings path, you will have to update your code.

Status: Fixed » Closed (fixed)

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