i've been around and around trying to figure out why this is happening but only have a really basic knowledge of javascript. thanks in advance to anyone who can offer any insight!

i had manual crop working perfectly earlier today, but at some point while building the site, something has caused a conflict. when i select a style from a drop-down menu to crop, the image appears on the screen at full resolution (not scaled to fit the screen), won't scroll, and i see no cropping tool. i hit save and the image disappears but no cropping has been saved.

the error that i see in the firefox and chrome console is on line 407 (412 in dev):

// Get the original width and height.
    var origWidth = ManualCrop.parseInt(image.get(0).getAttribute('width'));

Uncaught TypeError: Cannot call method 'getAttribute' of undefined.

I tried to retrace my steps to see what may have caused the problem, but nothing conclusive. I'm building with the Commons distro (and had manual crop working), and today enabled the transliteration and responsive images and styles modules. disabling and even uninstalling these modules does not solve the error.

ideas?

Comments

Matthijs’s picture

Hi,

It looks to me that you have an empty "image" object, did you change any theming (removed css classes, ids...)?

Do you have Firebug installed? If zo, please add following line before the line that gives the error:
console.log(images);

This will output the value of images in the Firebug console, if it's empty there is an image or css class missing...

Matthijs

ryanrain’s picture

Title: javascript error disables crop tool » careful! a sloppy jcaption css selector can break the crop tool
Status: Active » Closed (works as designed)

Thanks for your reply Matthijs!

your reply gave direction to my troubleshooting. i was getting nowhere disabling everything in my theme etc... :)

as it turns out, i had another module jCaption, set to strip classes off certain images and apply them to their container. this of course broke manual crop.

i ended up needing to tell my panels override to apply an additional class to the body tag where it will be used and where i will want captions.

again thank you for the excellent module!
-ryan