I have found that it is not possible to crop an image that has already been uploaded and saved. For example, you upload an image, crop it slightly, save the node. All works perfectly. You then edit the node again to crop again, you can set the crop area fine but it does not actually crop the image.

I would also like to thank the author of this module! I have been searching for this exact solution, and was about to begin writing my own module for it, but have very little experience with image manipulation and the image libraries! I am very willing to help with these issues, and so will be looking how to solve the above.

CommentFileSizeAuthor
#8 yh.patch862 bytesyhager

Comments

yhager’s picture

I'm glad you find this module useful.

Please note that after you crop an existing image, the image you see in your browser is a cached version of the image. Try to press 'Refresh' on your browser and see if that refreshes to the cropped image. I am not sure how this can be solved otherwise(changing the file name seems to me like an unacceptable solution).

Having said that, there was a bug that cause an existing image to disappear if you cropped it and clicked 'preview' before 'submit'. I have just committed a fix for it - grab it from CVS or wait till tomorrow (Jan 22) for packaging scripts to create a new version.

Thanks for reporting!

bones’s picture

Title: Can not crop an existing image » Imagecache not flushed after cropping existing image

On further inspection, I have found this is actually an imagecache issue. All that needs to happen is to flush the imagecache on line 190:

       		//flush the imagecache presets
       		if(module_exists('imagecache')){
      			imagecache_image_flush($file['filepath']);
      		}

Interesting you mention the browser cache problem as I was just looking at that myself. Why do you think that renaming the file is unacceptable? It seems to be the cleanest solution to me, especially as the file is actually changing (it has been cropped and therefor a different image).

Thanks for your response!

yhager’s picture

I committed the fix for imagecache. Please test to see if it works for you, cause I am not familiar enough with that module.

Why do you think that renaming the file is unacceptable? It seems to be the cleanest solution to me, especially as the file is actually changing (it has been cropped and therefor a different image).

It *would* be the cleanest solution had this was an independent module. However, this is just a widget on top of imagecache field, and as far as imagefield is concerned, this is the same file, so no necessary updates are not being made on the node.

bones’s picture

Thanks for that, will check and make sure it works.

Have started a new issue for the browser cache problem at http://drupal.org/node/212622

yhager’s picture

Assigned: Unassigned » yhager
Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

Lapino’s picture

Version: 5.x-1.x-dev » 6.x-1.0-beta2
Status: Closed (fixed) » Active

Apparently this doesn't work in the 6.x version of this module. Is it possible to implement this in the new version?
It's the only thing that this module needs to make it perfect for me.

yhager’s picture

Status: Active » Needs review
StatusFileSize
new862 bytes

@Lapino: Can you test the attached patch?

Lapino’s picture

I've tested it on a couple of pictures on my site and two different imagecache presets and the above patch seems to work.

The fast reply was impressive by the way, thanks!

yhager’s picture

Status: Needs review » Fixed

Thanks for the testing. Committed.

Status: Fixed » Closed (fixed)

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

mckeen_greg’s picture

I can confirm this works. However, a Hard Refresh is needed on my side (perhaps that was what was needed along?!)... now, is that Firefox or can something also be done about that? How many users will Force a Refresh to see changes to images, and how many will do so often? None Im assuming.

Edit: Ok... upon thinking about this further, I can confirm that this doesnt work. Patch installed correctly. beta version. Forcing a Refresh is not default behaviour when using ImageCache is it? I know that if I go to: ImageCache > Presets > [namespace] > Flush Cache, I wont have to force a refresh to see changes to my images... it just works. Can anyone else confirm this?

yhager’s picture

Please try and install the latest dev version of imagefield - it contains a fix to this hard refresh issue.

mckeen_greg’s picture

YAY! Fantastic! Installing the latest Dev version of ImageField fixed this.

May I suggest you commit the fix above? Your module is awesome, and I recall choosing not to use it last year for this very reason on a D5 install. Now that the behaviour has been ironed out, I am sure many people will be moved by it. :)

Thank you for your hard work!

yhager’s picture

@mckeen_greg: Thank you for the spirit :)

The core of the refresh issue is with imagefield, and I was able to send them a patch. They committed it and it is still in dev - and will be in their next release. There's nothing to do but wait for a new imagefield release.

xpersonas’s picture

Hey guys, I'm having this issue. I'm running:

ImageField 6.x-3.2
ImageCache 6.x-2.0-beta10
Imagefield Crop 6.x-1.0-rc1

I don't even see a dev for imagefield so i'm assuming i'm up to date? Anyone know why this is not working for me, possibly?

yhager’s picture

@phaedo5: I am not sure why this is not working for you, it should.
Could it be a permission issue? Do you have any special config or setup, or anything which can shed more light on this?

xpersonas’s picture

I wish I had more to share on my setup. It's pretty basic Drupal 6 site. I'm not doing anything funky. I don't have an issue, but it seems to be an issue to some of my users. They may be on Windows machines. I'm trying to get that information. I'm on a mac running FF.

yhager’s picture

maybe it is an issue with browser refresh that you are experiencing and not with imagecache flush.
What happens when you refresh the page? Does that fix the problem?

xpersonas’s picture

It may well be an issue with the browser refresh. Getting information from my users is like pulling teeth sometimes. But it sounds like it shows up when they clear their browser cache. So perhaps I mistakenly thought I was having the issue described in this thread. Sorry to waste your time on it. This module is awesome. It works great for me :)