Hey,

I just wanted to point out a possible issue between the media update and JS imagecrop modules.

I was wondering if JS imagecrop detects a file change & destroy it's linked crops accordingly?

Here's the link to the other module i'm talking about. It would theorically let me update the media file, but what about it's crops?
http://drupal.org/project/media_update

Comments

nils.destoop’s picture

Status: Active » Postponed

Downloaded the module, but it's not working on media 2.x. I'll wait some time, till it also supports that version.
I did a quick look at the code, and it looks like it creates a new fid. If this is the case, then the linked crop will be destroyed.

Marc-Antoine’s picture

I know it's not yet ready, I just wanted to prevent a bug.

thank you for your quick answer.

Marc-Antoine’s picture

Here's an update on this subject since media update now has a functional version for the 1.x branch of media

Using:
media update 7.x-1.x-dev
media 7.x-1.x-dev
Image javascript crop 7.x-1.0-rc3

The current behavior is the following:

The ancient crops are kept and applied to the new picture, causing unwanted display of the new picture (could be a black square if the original picture is larger than the new one).

The correct behavior would be to erase the existing crops if the original image file is updated.

Here's the media update issue: http://drupal.org/node/1380424

Marc-Antoine’s picture

Title: What happens to the crops of an updated picture? » Incorrect display of crops for an updated picture.
Category: support » bug
Status: Postponed » Active

Changing the issue status

shawn_smiley’s picture

I've added a new hook implementation to the media_update module that allows the Javascript Crop module to be notified when a media update occurs. You should be able to key off of this to perform any cleanup or adjustments needed.

Let me know if you need any additional information from the hook call.

Here is the hook code (also in the api file of the media_update module):

/**
 * Allows other modules to be notified when a user
 * updates an existing media file with a new file.
 *
 * @param $file
 *   The original file object from before the update.
 */
function hook_media_update_updated($file) {

}
nils.destoop’s picture

Status: Active » Fixed

This hook is now implemented

Status: Fixed » Closed (fixed)

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