Is there any way to have Imagecache actions work the result of an Imagefield Crop? I was hoping to be able to be able to added rounded corners to the scaled down version...

Anyone have any ideas?

Great module by the way!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johnmunro’s picture

This works fine just as it should. See here for an example http://www.dsty.jp/schule/news/christian-wulff-besucht-die-dsty

Is it going wrong for you or are you just not sure how to do it? If the latter, make sure you are setting the "Display Fields" properties tab in the content type.

patcon’s picture

Thanks very much john! I did end up figuring it out afterwards, although after the fact, I realized it would be nice to be able to manipulate the full imagefield_crop image with imagecache as opposed to just the cropped version. That way, imagefield_crop could be used to focus on an area of interest, and imagecache could manipulate the full image for other uses. For example, in field display settings (when editing content types), there's be two options to select for each imagecache preset --

_full and _crop. Unless this already exists and I'm getting ahead of myself again! :)
johnmunro’s picture

Title: Imagecache Actions afterwards? » Add uncropped image to Display Fields list
Category: support » feature

Patrick, does my change in the title of this issue match what you are thinking?

patcon’s picture

Yeah, perfect John! That's MUCH more concise...

mason@thecodingdesigner.com’s picture

subscribe. It would be nice if to be able to apply imagecache to both or either the cropped and uncropped versions

q0rban’s picture

subscribe. This would be really nice for modal image views. You can have the cropped version of the photo zoom to the full image size.

q0rban’s picture

Status: Active » Needs review
FileSize
5.99 KB

Attached patch adds uncropped formatters for each imagecache preset. Might be nice to add an admin interface to enable this functionality, as it definitely murks up your UI if you have lots of IC presets.

cels’s picture

Version: 6.x-1.0-rc1 » 6.x-1.0-beta3

Review the patch: works for imagecache.

The ".crop_display.jpg" it's a little bit weird filename, but it's works with imagecache profiles. Is possible to change the filename? By example, add a prefix instead the suffix.

Note, it's "quick&dirty" example:

function imagefield_crop_file_admin_crop_display_path($file) {
  $file = (object)$file;
	
  $filename = basename($file->filepath);
  $path = $file->filepath;
  $replace = 'original_display_' . $filename;

  return str_replace($filename,$replace,$path);
}
Anonymous’s picture

Patch works great for me, this is a really awesome addition, avoiding to create multi imagefields.
Thanks ! Can't wait to have this in next release !!

Bilmar’s picture

subscribing

jacktonkin’s picture

Version: 6.x-1.0-beta3 » 6.x-1.0-rc1

Patch #7 still applies to 1.0-rc1 and works as expected. This is a key feature for me too.

Some notes:
1. The filenames for uncropped images are a little odd (as noted in #8). Also, I uploaded a test.gif and got test.gif.crop_display.jpg (the image is actually a gif, not a jpeg). Could be a bug for another issue though, because it probably affects all crop_display images.

2. There is a todo in this patch that is copied from the imagecache module.

3. The formatters are added to all filefields no matter which widget is selected - this is the same behaviour as imagecache, so there may not be a way to fix this with the current APIs.

Would really like to see this (or similar functionality) in 1.0!

vinmassaro’s picture

Version: 6.x-1.0-beta3 » 6.x-1.0-rc1

Thanks all for the patch. One issue I am having is when using Imagefield Crop with the Dynamic Display Block module. I have Imagefield Crop set to put all images in a directory, and DDBlock to look in that directory to create a slideshow out of the images. The problem I am having after applying this patch is that the cropped versions get placed in the same directory, so I am getting duplicate photos. Is there a way around this? I tried to uninstall the module and install the unpatched 6.x version, but the database updates that we made by this patch are not uninstalled/reversed. How can I revert back to the core Imagefield Crop installation/database schema? Thanks!

q0rban’s picture

Hi vinmassaro! I'm pretty sure imagefield_crop has those images in the same directory by default. It has nothing to do with this patch. You might create a separate feature request that imagefield crop use separate directories for the cropped and uncropped images.

vinmassaro’s picture

Thanks for the info. In the meantime, reversing the patch did not remove the database updates, so when I upload an image, two version are still created. Any way to clear that all out and start fresh? Imagefield Crop doesn't have an uninstall option. Thanks!

smithn.nc’s picture

Subscribe.

q0rban’s picture

Title: Add uncropped image to Display Fields list » Add uncropped image to Display Fields list (imagecache)

Clarifying the title: this is about imagecache. For a generic image formatter that displays the full image, see #240849: Add an option to display the original image .

iamer’s picture

I am using the patch in #7 and it is working great.

Then I wanted to integrate lightbox so that when a user clicks on an "uncropped" variant of an image it displays a bigger version in a lightbox. However the lightbox imagecache presets don't pick up any "uncropped" variants. I tried fixing it in different ways, but nothing worked.

It would be great if someone pointed me in the correct direction.

Thanks.

q0rban’s picture

@iamer, I think you'd need to open a feature request in lightbox to add support for this patch, which I'm doubting they'll do until this patch is actually committed.

Currently I use highslide to achieve the same end you are talking about. You have to create the formatter by hand in highslide, however.

iamer’s picture

Thanks for the pointer to highslide, it is exactly what I needed. Very slick! Good thing I am not doing anything "commercial", yet.

shiva7663’s picture

Is this the issue that, if resolved, would allow one to show your original or preview images, and have Imagefield Crop be in charge of making the thumbnail that is associated with the main image (instead of replacing it)?

patcon’s picture

You got it shiva :)
Part of the idea is to allow imagecache to work on either one

silkogelman’s picture

i agree with #7 q0rban that adding formatters could murk up UI.
A possible solution may be instead of adding formatters to add imagefield_crop as actions for imagecache presets.
That way one could use imagefield_crop as an area selection tool, and add other actions to a preset if desired for use in views or lightboxes.
Possible actions could be: 'crop + resize' (as now is standard with imagefield_crop)
and 'crop only' ("regular" cropping, the result is a crop with the highest possible resolution available from the original image)

suedehead’s picture

Subscribe.

sholn’s picture

Hello,
I found an issue on the patch, it happens that images that does not need to be cropped does not have their uncropped file, at least for me does not work.
I've fixed that problem add file_exists check to the if condition:

function imagefield_crop_widget_value($element, $edit = FALSE) {
  if ($edit) {
    $file = field_file_load($edit['fid']);
    $field = content_fields($element['#field_name'], $element['#type_name']);
    
    $crop = $edit['data']['crop'];
    if ($field['widget']['resolution']) {
      list($scale['width'], $scale['height']) = explode('x', $field['widget']['resolution']);
    }
    if ($crop['changed'] || !file_exists(imagefield_crop_file_admin_crop_display_path($file))) {
      // save crop time, for preview
      variable_set('imagefield_crop_query_string', REQUEST_TIME);
      _imagefield_crop_resize(imagefield_crop_file_admin_original_path($file),
                              $crop,
                              $scale,
                              $file['filepath']);
    }
  }

  return module_invoke('filefield', 'widget_value', $element, $edit);
}
q0rban’s picture

Status: Needs review » Needs work

Ah, I was wondering why that happened to me the other day! Thanks for tracking that down.. :)

q0rban’s picture

Status: Needs work » Needs review

Actually, I don't think this is a bug with the patch, though, looks like it's a pre-existing bug with imagefield_crop.

sholn’s picture

Maybe, but you don't notice that because it makes a crop with jquery :)

mandclu’s picture

Subscribe, and +1 for this.

mandclu’s picture

Oh, and a new patch incorporating the fix from #24 is attached

kloewer’s picture

#29 works fine, what about integration with Lightbox2?

q0rban’s picture

Status: Needs review » Reviewed & tested by the community

As far as I can tell, the issue mentioned in #24 and added to the patch in #29 is actually a separate bug with imagefield_crop that should be filed in a separate issue and patch. I imagine the patch in #7 is still the one that should be committed. I'm going to go ahead and mark this as RTBC, since #8, #9, #11 & #17 all have tested the patch.

pragna’s picture

I Found following error after implementing patch.
I used => Drupal 6.15 ,
=> Image crop 6.x-1.0-rc2
=> ImageField 6.x-3.2
=> 6.x-2.0-beta8

Fatal error: Call to undefined function theme_imagecache_formatter_default().
Please help me..... I have urgent task.
Thanks In Advance.

danoprey’s picture

#7 worked well for me, although I would have liked a 'X image (cropped) linked to image (uncropped)' version, but I'm asking too much.

vikramy’s picture

Subscribing

GAMe’s picture

I too think this would be a massive improvement to what is already a great module. I am currently trying to come to a good solution to this myself.

dlnsk’s picture

Issue tags: +Lightbox 2

I added integration with Lightbox2. It's allow any variants of using uncropped files (as source or destination or both).
See patch for ligthbox2 here: http://drupal.org/node/1405354

  • ram4nd committed d2d01a6 on 6.x-1.x authored by q0rban
    Issue #426892 by q0rban: Add uncropped image to Display Fields list (...
ram4nd’s picture

Version: 6.x-1.0-rc1 » 6.x-1.x-dev
Issue summary: View changes
Status: Reviewed & tested by the community » Fixed
Issue tags: -Lightbox 2

Status: Fixed » Closed (fixed)

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