Download & Extend

Add uncropped image to Display Fields list (imagecache)

Project:Imagefield Crop
Version:6.x-1.0-rc1
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Issue tags:Lightbox 2

Issue Summary

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!

Comments

#1

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.

#2

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! :)

#3

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

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

#4

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

#5

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

#6

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.

#7

Status:active» needs review

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.

AttachmentSize
imagefield_crop_426892_7.diff 5.99 KB

#8

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:

<?php
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);
}
?>

#9

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 !!

#10

subscribing

#11

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!

#12

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!

#13

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.

#14

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!

#15

Subscribe.

#16

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 .

#17

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.

#18

@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.

#19

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

#20

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)?

#21

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

#22

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)

#23

Subscribe.

#24

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);
}

#25

Status:needs review» needs work

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

#26

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.

#27

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

#28

Subscribe, and +1 for this.

#29

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

AttachmentSize
imagefield_crop_uncrop_cache.patch 6.81 KB

#30

#29 works fine, what about integration with Lightbox2?

#31

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.

#32

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.

#33

#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.

#34

Subscribing

#35

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.

#36

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

nobody click here