I use Media selector widget to select images in my nodes. I also have Imagecrop configured on the same field.

Everything works fine if I open an old node. "Crop this image" buttons are there and everything works fine. Problem is when you select new image. This will:

  • if field was empty before that, no "Crop this image" button will appear;
  • button will be there, if there was another image in same field before, but imagecrop popup will open cropping dialogue for old image instead of just selected one.

I believe there is a problem how imagecrop button gets updated when new image is selected.

Comments

nils.destoop’s picture

What version of media are you using? I justed tested with 7.x-2.x-dev (7 dec) and everything looks working.

I create new article node, select an image with the mediafield selector, and the button shows up.

nils.destoop’s picture

Apparently you are using the multimedia asset. I tested using the image field as a media selector widget.

nils.destoop’s picture

Status: Active » Fixed

This problem should now be fixed on dev.

slashrsm’s picture

Status: Fixed » Needs work

I tested this and I keep having the same problem with the latest code.

nils.destoop’s picture

Everything works here.
When you view the source from the node add page. The js should be in following order:

Is this correct. If it is. Can you check with firebug, if

is hidden after the "Select media" button?
slashrsm’s picture

Button is there, but is hidden. If I un-hide it and click on it I get the following error:

The image to crop was not found.

Screenshoot: http://awesomescreenshot.com/039q7k6de

I am using Media 7.x-1.0-rc2. This is currently the only recommended version of Media.

jisuo’s picture

I have problem with this as well. I use Media 7.x-2.0-unstable3 and Image javascript crop 7.x-1.0-dev.

This is on a Image field on a custom content type.

It works if I use the Image widget on the Image field, but if I use the Media selector widget the crop-button has display: none and if you unhide it and try to use it you get the same error message as in post #6 ("The image to crop was not found.").

nils.destoop’s picture

Status: Needs work » Fixed

This should be fixed now.

slashrsm’s picture

Status: Fixed » Needs work

I tried on 7.x-1.x and the bug remains there.

It would be much easier to test new code, if you'd upload patch to the issue and put it into a review process. It would be much easier for us to provide good feedback this way.

nils.destoop’s picture

Patch can be found here: http://drupalcode.org/project/imagecrop.git/patch/60e0387

Before this patch, things where not working on node/add.

Can you show me a screenshot of your fields on the node form. Then i'll create the same content type.

The problem is that media doesn't have a js hook. So to do something when an image changes, i have to take over all his code.
Because of this, it's very important that imagecrops js is loaded after the js from media.

andykisaragi’s picture

HI, I am having the same problem on node/add with latest dev versions of media and imagecrop - works for an image with image widget, but not media file selector widget. I can't see that there's any js on the page for imagecrop.

bryancasler’s picture

Confirming the problem with the latest dev when using the media widget. Also, there is no cropping button being hidden on the page, it's just not there.

nils.destoop’s picture

Confirming the bug. Media module changed the field structure. Busy with implementing this.

Media 7.1 will need a small patch to keep working with imagecrop. I'll post the patch here.
They introduced a javascript event in 7.2, this way, i don't need to overwrite media's code.

nils.destoop’s picture

Status: Needs work » Needs review

I just committed a big change for media support to the dev. A patch can be found at: http://drupalcode.org/project/imagecrop.git/patch/320dfd1313d9b97025bfae...

This fixed all issues for me on both media 1.x and 2.x.

bryancasler’s picture

Status: Needs review » Closed (fixed)

I can confirm this is fixed

slashrsm’s picture

Confirmed.

slashrsm’s picture

Issue summary: View changes

Fixed a typo.

fvictoire’s picture

Is the patch in the stable release of the module Media (Media 7.x-1.4) ?

I have reproduced the bug with this release of Media (release of Image Javascript crop is 7.x.1.0-rc3).

Thanks for the answer.

ianthomas_uk’s picture

7.x.1.0-rc3 is very out of date. As it says on the project homepage, you should use the -dev release for now.

fvictoire’s picture

Hi,

thanks you for the answer.

I have the crop button with the dev module of Image Javascript crop (7.x-1.0-rc3+68-dev), but when I click on the save button after cropping this error appears :

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'rotation' in 'field list'

I can not save the new cropped image.

ianthomas_uk’s picture

Is your database up to date? If it is, please can you open a new issue for that error.

fvictoire’s picture

It was just a problem of database update.

Thanks.