Following the report at http://drupal.org/node/490470 I prepared a patch for filefield_insert that will allow insertion of imagefield_crop based images.

Comments

merto87’s picture

Thanks!!

Waiting for commit! ;)

buckley’s picture

Just tried it and it seems to work

presleyd’s picture

Does not seem to work for me. I am not using Filefield sources however, just imagefield, imagefield crop and filefield insert. The option to 'Send to Text' is present using the Image with crop widget and it seems to add the image to the WYSIWYG menu. Everything would be peachy except that the cropped image doesn't seem to the one being sent up. I get the original image although it is re-sized to the dimensions that the cropped image should have been.

*edit... sorry I hadn't refreshed the page. Ooops. Working now.

alan d.’s picture

Title: Allow inserting of imagefield_crop widgets too » Allow inserting of other filefield widgets

This imagefield_extended_widget is another widget that could be added, and when D7 comes out, there are probably going to be many more.

Maybe having some hook based dynamic solution is best to ensure that this module doesn't have a depenency on any of these additional modules.

eg: something like:

<?php
/**
 * Returns an array of imagefield and filefield widgets, indexed by the implmenting module.
 */
function hook_filefield_insert_widgets() {
  return array(
    'imagefield' => array(
      'image widgets' => array('imagefield_widget'),
    ),
    'filefield' => array(
      'file widgets' => array('filefield_widget'),
    ),
    'imagefield_crop' => array(
      'image widgets' => array('imagefield_crop_widget'),
    ),
    'imagefield_extended' => array(
      'image widgets' => array('imagefield_extended_widget'),
    ),
  );
}

?>

This is just some food for thought, but it would prevent multiple future patches.

quicksketch’s picture

Project: FileField Insert » Insert
Version: 6.x-1.x-dev » 6.x-1.0-beta1
Status: Needs review » Active

Moving this to the new Insert module. Insert now provides hook_insert_widgets(), which can expose any CCK field to use the Insert API. I'd prefer to keep the supported modules to ImageField, FileField, and ImageCache, since all these modules have been moved to Drupal core and will need to be consistently supported in the Drupal 7 version of Insert.

brightbold’s picture

I was just wishing for this functionality for Imagefield Crop as well, although it sounds like you're saying you're not planning to support that? If so I'd like to make another plug for that functionality - in my mind ImageField, ImageCache, Imagefield Crop, and Insert together are the image handling solution Drupal has been waiting for - my clients can upload an image, either have it sized to my specifications or allowed to resize or crop it themselves, and then place it in the body of their content.

Except that the crop-it-themselves-and-place-it-in-the-content piece doesn't work. But if it did, it would complete the perfect package. So here's hoping.

quicksketch’s picture

Imagefield Crop as well, although it sounds like you're saying you're not planning to support that?

I was saying that Insert won't bundle the support for imagefield_crop into it's code. ImageField Crop however can easily add support for Insert by implementing hook_insert_widgets().

yhager’s picture

@quicksketch: Please move this issue to imagefield_crop queue when the Insert part is ready. I will take it from there. Thanks!

quicksketch’s picture

Project: Insert » Imagefield Crop
Version: 6.x-1.0-beta1 » 6.x-1.0-rc1

Sure thing yhager, I know you had a patch ready for FileField Insert for *ages*. Thanks!

quicksketch’s picture

Title: Allow inserting of other filefield widgets » Insert support for ImageField Crop
mrfelton’s picture

just what I need. subscribing

Bilmar’s picture

subscribing

brightbold’s picture

Excellent. Thanks, quicksketch and yhager!

elijah lynn’s picture

@Yhager - When you have some time to work on this can you implement this so it also works with Image Resize Filter. It would be amazing to be able to crop the image first and then ship it to the Image Resize Filter/Insert. I have no clue how to do this but the workflow would ideally be ImageField Crop > Image Resize Filter > Insert.

This combo would be killer!

robby.smith’s picture

+1 subscribing. #14 sounds like a cool idea.

tsvenson’s picture

+1 This is the last box I want to tick for image support for the sites I am working on.

akaserer’s picture

this module also works with filefield sources if you apply this patch for filefield sources :

http://drupal.org/node/495210#comment-2534276

scottrigby’s picture

I definitely want to keep tabs on this

YK85’s picture

subscribing

lolmaus’s picture

Subscribing

JeremyFrench’s picture

Subscribing, maby be able to get a patch togeth later today.

brightbold’s picture

+1 on #14. I'd love to have this kind of seamless image editing and inline placement capability.

@JeremyFrench - My birthday's tomorrow. A patch would make a great present! ;)

nibblebot’s picture

subscribe

AliciaW’s picture

I am having the problem where the cropped image is now displayed and I did lots of refreshing, cleared the cache, etc.

jthorson’s picture

subscribe

jthorson’s picture

Title: Insert support for ImageField Crop » Add support for 'Insert' Module to ImageField Crop
Version: 6.x-1.0-rc1 » 6.x-1.0-rc2
Status: Active » Needs review
StatusFileSize
new817 bytes

Here's a patch to add the hook_insert_widgets() function, thus providing integration with the 'Insert' module. I've successfully tested in my dev site with CKEditor, Imagefield, Imagefield_crop, Insert, and Image Resize Filter all working together.

However, 'working' doesn't necessarily mean that they're playing nice with each other ... there are a couple of gotchas. For example, the Imagefield_crop processing all takes place within the node form submission; so the crop dimensions are not known until after the form processing takes place. This results in the image being pasted into your editor with the original image dimensions, instead of your crop dimensions.

To get around this, you can set your crop area, click 'preview', and then click the 'Insert' button after the preview has been generated.

As a summary:

Workflow What appears in Editor* What appears on Node
Upload->Select Crop Area->Insert Full image with original dimensions Cropped image with original image dimensions
Upload->Select Crop Area->Insert->Resize Full image with resized dimensions Cropped image with original image's resized dimensions
Upload->Select Crop Area->Preview->Insert Cropped image with cropped dimensions Cropped image with cropped dimensions
Upload->Select Crop Area->Preview->Insert->Resize Cropped image with resized dimensions Cropped image with resized dimensions

* This column also describes what appears in the editor on subsequent edits.

Notes:

  • Tests performed with all of the the imagefield_crop resolution/enforce settings set to 0, with the exception of the "max and min resolutions for Images" settings.
  • Patch is against current 'recommended' release (6.x-1.0-rc2) ... but should be easy enough to apply to dev as well.

Update: Forgot to mention ... I used the 'Original Image' setting when inserting - not very intuitive; but the imagefield_crop info gets applied against the 'original image', your mileage may vary with any other preset/setting.

zoo’s picture

It works for me. Thank you very much!

Just added the function specified in the mentioned patch (imagefield_crop-insertmodulesupport-495206-26.patch), at the end of the "imagefield_crop.module" file.

Are there any known drawbacks? It works fine here...

wooody’s picture

Thanks ZOO for your Explain , I add the code to multiupload_imagefield_widget.module for Multiupload imagefield module in /public_html/sites/all/modules/multiupload_imagefield_widget but it's not work... Any help please.

i tried also to add in /public_html/sites/all/modules/multiupload_filefield_widget
multiupload_filefield_widget
multiupload_filefield_widget.module
multiupload_imagefield_widget.module

/**
 * Implementation of hook_insert_widgets()
 * - Provides integration support for the 'Insert' module
 */
function multiupload_imagefield_widget_insert_widgets() {
  return array(
    'multiupload_imagefield_widget_widget' => array(
      'wrapper' => '.filefield-element',
      'fields' => array(
        'alt' => 'input[name$="[alt]"], textarea[name$="[alt]"]',
        'title' => 'input[name$="[title]"], textarea[name$="[title]"]',
        'description' => 'input[name$="[description]"], textarea[name$="[description]"]',
      ),
    ),  
  );
}
zoo’s picture

@wooody,
I'm sorry, I cannot be of any help, since the above lines were referring to the "Imagefield Crop" module, while you are trying to integrate the insert button to the "Multiupload Filefield Widget" module (which I do not use).
You may want to look for support at the "Multiupload Filefield Widget" issues section.
Good luck!

wooody’s picture

Thanks ZOO , Multiupload Filefiled widget not answer .