Here's a re-roll of a patch I did last year.
I thought I posted it, but can't find it again...

Basically - I want to run imagecache over the built-ins, and not have to screw up other modules and themes by using imagecache pathnames.
When image_build_derivatives runs - it may use imagecache presets.

The UI is quite ugly due to the way that image.module has themed its table, but I managed to shoe-horn the setting into it anyway.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dman’s picture

Screenshot failed for reasons unknown. twice. So here's the one I prepared earlier.

And a patch with 5 whole spaces added to it to make it code formatting-compliant :-}

dopry’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hey dman I totally love this patch, but Feel it could be a great standalone module... I'm not sure that I really have the personal bandwidth to track the changes in image.module as well as imagecache.module...

I've even been thinking of splitting out a separate imagefield_imagecache.module to expose imagecache formatters to CCK. To make my life as the maintainer of imagecache easier...

How would you feel about making this a stand alone module? I'd really love to see it in the wild... or making it a part of image.module officially. I really want to keep imagecache simple..

.darrel.

dman’s picture

Well, this addition is only a bit of glue between the modules, with no character of its own, so I don't see it as a stand-alone entity really.
However, It looks like I can roll it up independantly, so I'll try that. I hear you about tracking the changes in dependancies, it's a bit hairy.
Still, not worth a hook or API to get image presets to look for any other processes... that's the long-term way to do this.. but overkill when AFAIK imagecache is the only one ever to provide such a function...

I'll turn it into a stand-alone contrib and see if the image guys want it. I do NOT want to create a project for this.
.dan.

yngens’s picture

both of the patches produced Hunk lines

dman’s picture

This one goes against HEAD - revision 1.54. Which did you try it against? It may have been tagged against 5.x.2.0-beta wrongly. There's too many threads for me to figure nowadays.

dopry’s picture

Yeah I'm not really sure whether the image/imagefield integration should be a part of imagecache or image.module.... I think I may roll this as a contrib imagecache module and move the imagefield integration to the same... maybe move imagecache_profiles there as well... I want people to be able to pick and choose the middleware for their Drupal... not to get a kitchen sink with imagecache.

sun’s picture

Project: ImageCache » Image
Version: 5.x-2.0-beta » 5.x-2.x-dev
Component: User interface » image.module
Status: Postponed (maintainer needs more info) » Active

+1

Providing this as an optional contrib module in the ImageCache project/package sounds good. But I think this patch enhances Image.module in reality, not ImageCache. So providing this feature in the Image package might make more sense.

Moving to Image's queue to hear about drewish's opinion on this.

dman’s picture

I guess you are right. It is adding to image.module more than vice versa.

And I have to do some hoopy mess to get the table/form formatted whan trying to form_alter from an external module. image runs its own theme to do form layout ... but that means extending it with a column was hard! It would be better if image.module did this extra form building internally.

xurizaemon’s picture

subscribing.

dman - anything come of this with image.module? should we be checking an issue over there too?

xurizaemon’s picture

I tried this patch out today. As the patch doesn't remove any existing code, I just added it as _form_alter() and _image_alter() in a separate module.

Here are my results:
* It adds the UI to image.module's settings page. I can add a new image preset and choose an imagecache profile.
* It adds the matching select option to my image_assist popup. However, imagecache profile 1 replaces image setting 1 - so my image.module setting "Original" is replaced with the first imagecache preset.
* I don't see any difference in the resulting inserted image.

dman, I'm intrigued by your statement,

I want to run imagecache over the built-ins, and not have to screw up other modules and themes by using imagecache pathnames.

I hadn't noticed imagecache do this - can you elaborate some?

Would love to have a hand in pushing this further. It is driving me batty that a great toolkit like ImageCache doesn't play friends with TinyMCE :)

This episode was brought to you by the version numbers:
* ImageAPI + ImageAPI GD 5.x-1.1
* ImageCache 5.x-2.0
* Image Assist 5.x-1.6
* TinyMCE 5.x-1.9

dman’s picture

My reluctance to use pure-imagecache methods and instead shoehorn imagecache behaviour into image.module presets is straightforward.

Many of the image-modules I've been working with respect the image.module presets (_original,thumbnail, preview etc), and often present them as settings to choose from - eg views, image_attach, taxonomy_image.
They were not (last year anyway) as savvy about presenting imagecache options, and so to use imagecache usefully either some code, or more often some tricky (unconfigurable) custom theming had to happen.

It seemed better to add the options to image.module, then draw on them from the other modules, than to add imagecache-compatable additions to each of these third-party mods. That's pretty much all I meant by 'screwing up the paths' - anything that used imagecache had to be imagecache aware and use odd long imagecache pathnames. I prefer to use the pathnames as managed by image.module

That said - I've found in a recent (several thousand image) project, that forcing image.module to build all its derivatives at once is a bit painful for the server, and possibly on-demand imagecache behaviour also has its place!

xurizaemon’s picture

Thanks for the reply. I agree that it's better to get this into core image.module than imagecache - and also that on-the-fly generation is generally more efficient (because images don't get created until they're used).

I'll have a look at why the imagecache presets are overwriting, rather than being appended to, the image presets in that form.

Would be keen to liase with you in pushing this one forward. We have an (NZ-based) project which wants some similar functionality, so it would be good to touch base. (Did I email you separately? I meant to!)

antiorario’s picture

subscribe

luco’s picture

FileSize
34.34 KB

works like a charm. I love it. doesn't it just make sense? how come no one'd thought of that before?

here's a patched version of the module, for all those not-tech-savvy such as meself; just rename it to imagecache.module and replace the original file. I didn't patch this properly, I only added the last lines. but worked anyway and might come in handy for some folks out there.

(I don't have to tell you to backup and test, do I?)

I'd like to ask developers: PLEASE post PATCHED versions of modules. the whole point of using Drupal is to abandon lines of code. I know patching is simple for a webdeveloper, but webdesigners get really stuck in that point. ok? ;]

anyway, kudos to ye, dman. keep up the good work.

dopry’s picture

Project: Image » ImageCache
Component: image.module » Code
Status: Active » Fixed

commited with UI modifications as imagecache_image.module...

Functionality untested. cheers. open new bugs for it if they arise...

EgonO’s picture

Component: Code » imagecache_image module
Status: Fixed » Active

seems to work fine. but if one changes the imagecache-preset the derivates are not updated. one have to manually delete all the preview/thumbnail files on server.
derivate-images should also be put on the corresponding imagecache-folder not directly in the files/images folder (actually they are named xyz.preview.jpg & xyz.thumbnail.jpg directly in the files/images folder)

dman’s picture

True.
This integration mimics the image.module behavior closely, just using imagecache processing at the time image.module wants to make its derivatives.
This is deliberately to be transparent to the other modules that are built around any of that existing functionality. Several (like lightbox) count on image derivatives being in the predicted location. Others check for the file existence, which would fail if imagecache was being dynamic.
If image.module makes a thumbnail, it saves it in the normal place. Yep. That's intentional.
If image.module rebuilds its derivatives, the derivatives get rebuilt. On demand according to image.module behaviour.

Basically there is no 'caching' magic going on here anymore, only the imagecache filter processing. This was initially created to support watermarking thumbnails etc that imageapi does and image.module doesn't.

This request is reasonable in other use-cases, but has some awkward implications, as the two modules work quite differently. imagecache doesn't keep a database list of files, so relies on just deleting full directories. That is incompatible with the way image.module keeps a list of attached files in the file table. Updating (removing) files would require sending messages to the DB that the files were now missing. Altogether not really what I'd intend.

An optional approach, with different code, that does what you want could be created, but it's essentially a different approach, code-wise.

dopry’s picture

Status: Active » Closed (fixed)

I'm keeping this closed.. the integration is only to allow image.module to use the imagecache processing pipeline. You'll have to rebuild derivatives from image.module to update your thumbnails. It can be a time consuming process, but is intended to do things the way image.module does things.

PeteS’s picture

When trying to use this, I pretty much immediately get errors (posting the form on the Image settings page) complaining about how a width and height weren't set. Then, it seems that the regular image derivative building is still taking place, and so I get a dozen pages of errors about trying to generate ""x"" images. I certainly expect bugs in any new or existing release, but am I completely missing something here or does this just not work at all?

dman’s picture

So were the width and height not set? Is there a reason you didn't want to follow the instructions?
Image.module validation still requires them to be set to something, even if they are overridden or ignored by the imagecache process. It's sorta a quirk, but it's described in the help text there on that page.
EDIT:
Apologies, I was referring to an earlier version of the UI. I see the current DRUPAL-5--2 (dev) has been slightly modified.
But I'm not seeing the complaints you mention either. What exact image.module and imagecache.module checkouts do you have?

dman’s picture

On investigation, it looks like there is an issue with the current 'imagecache' selector UI totally replacing the previous 'preview' and 'thumbnail' sizes. Although they are in the form, they are hidden.
Now, this works (for me) and looks a little better in the UI than my earlier attempt. But does force the user to go all-or-nothing. Either use imagecache for every resize, or none. No mix-and-match. Which does eliminate some confusion (which I'd introduced :-} ) over which dimensions really get used.

Although the hidden default thumbnail sizes still work as a fallback, they are not configurable.

The UI is simpler, and basically DOES work. But there's this hidden issue there. A tiny bit of lost/confusing functionality. I can live with it, but we can probably document it a bit.

If you enable "imagecache 4 image", all the resizing (derivative building) process will be taken over by your existing imagecache presets. If you want to change thumbnail sizes, create your own imagecache preset to do so, and select that in the image settings screen.
If you do not, image.module will continue to generate thumbnails but at the default dimensions which you can no longer change easily.

... I still can't replicate the errors PeteS describes. ( image.module DRUPAL-5--2 ) ( or DRUPAL-5--2-0-alpha2 )

dman’s picture

OK, I've now been able to replicate the problem on a clean install(s)

Here's a significant re-write, that now uses the image.module 'operations' selector to choose the image process. So it co-operates with the image settings form instead of mutilating it.
... Actually, it SEVERELY mutilates the FAPI behind it by inserting the imagecache options, then extracting them, hiding them, and tricking image.module into thinking that all is normal. But the UI is perfect.
I've thrown out the theme overide we were using, and added logic to the validation phase.

So I'm attaching a D5 patch, the full D5 module file for convenience, and also a D6 port of the same thing!
The CVS I could see imagecache-6.x-1.0-alpha2 didn't even have this addition in it, so I guess we can call this a clean start.

Requires/works with todays image.module dev releases for D5 and D6. I hope they are stable.

dman’s picture

Status: Closed (fixed) » Needs review

Oh, better re-open.
Maybe I should have made a new issue ... but I had this thread open for a few hours waiting to post this fix :-/

nicholasThompson’s picture

I am also suffering this problem...

My 'hack' was to force the form value to 1 by adding this below the form_alter 'hidden' lines...

 $form['image_sizes'][$key]['width']['#value'] = 1;

I've just learned the implication of this... When I submit an image using image_attach the image ends up being 1x1!

I might re-checkout the module and try your method @dman.

nicholasThompson’s picture

dman - I just tried your patch and am still getting the following issue when I submit an image...

The original image was resized to fit within the maximum allowed resolution of 1 x 1 pixels.

Is this related?

nicholasThompson’s picture

Ah fixed - using your patch I had to change the "Original" preset for an Image to Scale Image and then leave the width and height blank. Works perfectly now!

I can +1 this as "good". Nice one dman! :)

dman’s picture

That hack was the first quick way out, yeah, but clearly it's cheating. Any problems you got would have been due to an unclean setting, I'm pretty sure you won't get that on a new site.
I'm happy to finally have fixed the UI. Ever since I started, the image settings table layout has been tricky to work around. Now I think it's the way it should be.
The code however could be mode drupal-hook-based instead of the form hack it is now ... but I'll bounce that off the image.module guys I guess.

dman’s picture

bump.

http://drupal.org/node/231622#comment-973178
is a stand-alone update of the imagecache+image.module glue.
It only affects its own imagecache_image.module file, so won't break anything that's not using it.

It's got a D6 version too.

bump-a-dump

.... yeah, I definately should have made a new thread :-}

HansBKK’s picture

Noob here seeking clarification, please correct any of the below summary if I'm mistaken:

Function:

This allows one to use imagecache with the Image module rather than CCK/Imagefield, but loses the dynamic caching behaviour, only creating static derivatives, which will then be used as if they had been created by the Image module by all the other related modules that work with such files (files? - see below)

Procedure:

install and configure imagecache as usual

download imagecache_image.module.txt from http://drupal.org/node/231622#comment-973178 and rename it to imagecache.module

Overwrite imagecache.module in the imagecache folder with the new version

Questions:

Are the images ("original" + derivatives) files stored in the filesystem, or BLOBs stored in the database?

How specifically does one delete the derivative images previously created by Image module and force their regeneration with the new imagecache process?

How should this be set up to protect from this scenario: Image and Imagecache move on in the development cycle and no one does anything further with this fork?

TIA. . .

dman’s picture

1 - they are files, stored in exactly the same way and place that image.module stores its an_image.preview.jpg files.
2 - image.module provides a 'regenerate derivatives' button for each image, and a bulk function through the content manager to do the same. Mass regenerations can also be triggered by changing any dimension in the derivative preset screen.
3 - There's been some support for this utility in theory, I'm not sure why we just haven't got around to rolling it in. I'm not pushing it in myself as a matter of courtesy, because as I submitted the change, I'm not also going to say it's RTBC.
But if at any stage you choose to upgrade to a clean, unpatched distro, then things will continue working as before, and the imagecache-processed derivatives will be overwritten by the plain image.module processed ones. You loose the feature by removing the code, but you don't loose any data or anything.

HansBKK’s picture

Thanks very much for your clarifications, seems like a good way to go and thanks for putting in your time to help END THE MADNESS that is images in Drupal

I'd also greatly appreciate (if you have time) your letting me know if I'm completely off-base with this idea on combining the two main methodologies:

"Images in Drupal - Future-proof methodology (Image module + imagefield together)"
http://groups.drupal.org/node/14974

HansBKK’s picture

Sorry to bother you Dan, but in following my above step-by-stop, I've just downloaded the current imagecache-5.x-2.x-dev from 2008-Jul-24. When I went to enable it, I saw along with imagecache module itself and its UI, a third module called "ImageCache 4 Image 5.x-2.x-dev Imagecache integration for Image module"

Q1 So is this equivalent to or later than your imagecache_image.module.txt contained in http://drupal.org/node/231622#comment-973178?

In other words am I good to go with the former without having to install anything else? Or is the latter one later or otherwise still needed?

And Q2 I've currently got Image v5.x-1.9 working, should I upgrade to 5.x-2.x-dev or 5.x-2.0-alpha3 (looks like they're the same) before enabling your fork? Note this is all going to be for a production site. . .

Finally Q3 is there anything we non-coding hoi polloi can do to help campaign for this functionality to get rolled into the mainstream Image?

Thanks for your help, and all your great work for the community.

dman’s picture

Heh.
Sorry, I was severely jet-lagged last week!
I'd totally forgotten that "ImageCache 4 Image" is now part of the image package. It's a fully compatable and independant glue module. And I fixed up the UI better too. I should have closed this thread.

The glue module - available only to those that want it, not affecting those that dont, using only public hooks to do the job, is a perfectly fine place for it to live. No more action needed, just a bit more MEMORY on my part.

It should just bloody work, But probably it's imagecache DRUPAL-6--2, the 6--1 is quite outdated, and the alpha/dev has been stable for months.

HansBKK’s picture

Thanks for the lightning response Dan, and rest assured any and all brain-farts are completely by the by, your brain's forgotten 100x of what's in most of ours'.

I'm happy to know I'm good to go with that dev version of IC without needing anything further from this issue thread. And although I like the "just work" comment, I'm still a bit confused by your D6-related comments since I'm on Drupal 5.

Therefore I'm still not clear on what version of Image module I should be on to work with your "ImageCache 4 Image" module - a one-letter answer will suffice:

>> I've currently got Image v5.x-1.9 working, should I upgrade to A 5.x-2.x-dev or B 5.x-2.0-alpha3 or stick with C stable v1?

Thanks 2

HansBKK’s picture

Hope you don't mind me talking to myself here, but for the benefit of those coming here later. . .

I went ahead and tried implementing "ImageCache 4 Image" on a scratch site with Image v5.x-1.9, and so far everything looked A-OK, as long as I only selected IC presets for the first three rows in the Image UI (original, thumbnail and preview, left column options were grayed out.) But when I tried to fill in from no. 4 on, where there's empty left-hand fields to fill in with my own preset names, Image kicked out an error message about width and/or height not being set, as per http://drupal.org/node/231622#comment-938919 above. However, the traditional fields in the middle columns that were used by Image before for setting the WxH parameters are now completely missing from the UI.

I figured this may well mean I should be using Image 5.x-2.x-dev version (2008-Aug-17) so I upgraded, ran update.php selecting Image "5200", tables updated but no joy.

Trying another tack, I disabled "ImageCache 4 Image", went to the original Image config UI, put in dummy width values and saved, then re-enabled ImageCache4Image everything's hunky dory.

Uploaded a JPG and bah-da-bing bah-da-boom, one big original and 5 derivatives sitting in the Images folder!

BTW Q1 I still don't know whether I should have upgraded the Image to 5.x-2.x-dev or not, good thing I did all this on a scratch site :)

Subsidiary Q's:

Q2 I guess the imagecache folder will remain empty unless I start to also use imagefield access methods?

Q3 As long as I stick to Image type nodes (as opposed to Imagefield CCK ones), then Views (and everything else) should be able to pick these up as if they were Image-generated, right?

Q4 I wonder if I do start to use Imagefield nodes, can I configure it to use the same directory/filenames as Image? If not, NBD, disk space is cheap eh?

Finally, I'm so far a very happy camper Dan, thanks so much for this brilliant effort.

IMO this should get folded into the mainstream Image module now, one step closer to the grail of ending the insanity that is images in Drupal.

Maybe this is a good place for you (that is everyone but Dan da man) to put your +1:

http://drupal.org/node/145071

nicholasThompson’s picture

I can personally "+1" DMans patch from #22 with one "minor" tweak...

The patch worked PERFECTLY if I added one preset, but the second preset caused headaches. I ended up rounding it down to the fact that derivative generation was passing a "preset" over which has zero width and height. Fix? Simply add a hardcoded 1x1 width and height... Seems to fix everything :-)

I've attached my revised version of the patch... Anyone care to review? :-)

HansBKK’s picture

@nicholasThompson - I don't yet know how to patch so I can't test your code, but rather than working from the code in dman's post above, I reckon using the "imagecache 4 image" module shipping as part of the latest dev release of Imagecache would be the way to go. I had no problems at all with it once I created the "dummy presets" in Image's config screens before enabling I4I - these settings get ignored, but apparently need to be there.

Answering some of my own questions from knowledge gained in the meantime, again for the benefit of those coming here later:

Q1 still don't know, if someone gets the latest dev of Imagecache's imagecache4images working with the stable version of Image, please post here to let us know.

Q2 yes, Imagefield will dynamically generate its derivatives of images stored in ANY location and uploaded from ANY source simply by using its URL access scheme, and nothing will appear until then.

Q3 yes, so far all Image-module compatible add-ons treat the derivatives created by imagcache4image as if they were natively created by Image module.

Q4 haven't done any testing, but from discussions elsewhere seems to be a bad idea to have different modules "sharing" the same files - let each have full "ownership" over its own files, and if you need to say save images as nodes with Image module AND embed them in Imagefields, you need to accept the image files being duplicated in different folders.

dman’s picture

I'm having a heck of a time retrieving imagecache_image from CVS.
It's there
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/imagecache/...
But doesn't seem tagged right, and is not coming with any checkouts I've tried so far.
Thus it's hard to update and test - at all.
Can someone investigate its CVS status?

dman’s picture

OK. Here is a re-roll/re-port.
Working against todays imagecache.module HEAD (D6) and image.module HEAD (D6)

I sorted out the validation as per
http://drupal.org/node/318434

I've worked around the dimensions problem noticed in
http://drupal.org/node/303751 and http://drupal.org/node/329527

I added a trigger that DOES flush image.module presets when a linked imagecache preset changes as discussed ... um, in another issue somewhere. During testing I found it a bit unintuative, and image.module does just rebuild on-demand, so I'll let the system take the hit.

Hopefully the code is even tighter (I use more of the D6 Form API tricks).
Changed the description a little and the dependancies are imagecache and image.

The CVS branch this module USED to be on seems to be broken, so I can only imagine these files should be added anew. Can we try again?
If not, hey, it can even be downloaded as-is and be its own little working distro.

open-keywords’s picture

this thread was about D5 and image-cache 2.x

dman’s picture

Version: 5.x-2.x-dev » 6.x-2.x-dev

OK.
It was.
But this didn't make it in correctly back then, and the idea is that new features go into HEAD and get backported, maybe. So the issue was brought forward, even though there is a working patch there for D5.
If it makes you happier, I'll update the status. Done.

HansBKK’s picture

And just to confirm re D5, I've had zero problems with the "imagecache 4 image" module contained in

imagecache-5.x-2.2

working together with

image-5.x-2.x-dev-2008-Aug-17

I used the dev Image module when testing and never did try it with the released one, still waiting for feedback on whether that should work or not (I suspect yes)

dman’s picture

There were issues with sizes getting unset or needing to be set to something to make image preset validation work, even though they were being overridden, but I think we've got workarounds in place for that.
There was just some sort of CVS split that made it tricky to check a fixed version out. The 'released' one is inaccessable to me :-/ Dunno why.

PlayfulWolf’s picture

+1

this module is definitelly "TOP 1" glue module for Drupal.

one small question: have any plans for Drupal 6 version?

dman’s picture

#39 is D6.
Just needs CVS love.

drewish’s picture

though now that imagecache is getting pretty stable i've come around to the idea of making the image module dependent on it for thumbnails. what do you think of moving this issue back over there?

dman’s picture

Urr...
If you mean what it sounds like, that doesn't sound like a great idea to me.
I think there are a larger number of sites that get by with just the image.module quite happily - than there are imagecache.module users that don't use image.module. I may actually be wrong with the growth of imagefield + imagecache uses (?).

I appreciate the idea of reducing the duplication of the current 'scale' function provided by the basic image.module. But that's not a huge hit or inefficiency, and the ability to "just work" is not worth sacrificing to reduce the code by 3%.

I don't think imagecache should be made required for image.module. Adding a flashy requirement to a cool, simple, purpose-built module like that should not be necessary.

...although the derivative generation process could possibly be abstracted a little more to make it friendlier to plug the two together. ... even though this imagecache_image.module manages to do it OK, if a bit sneakily.

I still see the imagecache_image glue module as conceptually belonging to imagecache. Even though the code itself does mainly do its business by extending image.module, the functionality and feature set is all about imagecache.

AltaVida’s picture

subscribe

scroogie’s picture

I'd actually like to see the integration. Looking forward to your decision.

dopry’s picture

Project: ImageCache » Image
Version: 6.x-2.x-dev » 6.x-1.x-dev
Component: imagecache_image module » image.module

@drewish: I'm in favor of moving it back to image.module as well...

dman’s picture

I really don't mind where it lives - as long as someone wants it.
Please, just take it and commit somewhere.
.dan.

scroogie’s picture

Yesterday I had a weird problem with the page where I'm using this page. An image where the derivatives had to be regenerated called convert with size parameter "0x0!" and I had a duplicate entry for "Original" in the image settings. I don't know if it's because of this patch or because of my test site (im trying out a lot of stuff, so it might be my fault). Did someone else see this already?

altavis’s picture

Image 6.x-1.0-alpha4, ImageCache 6.x-2.0-beta5 and this ImageCache for Image - Image derivatives cannot be properly set using ImageCache presets.

# warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /public_html/d6abc/includes/image.gd.inc on line 95.
# warning: imagecolorallocatealpha(): supplied argument is not a valid Image resource in /public_html/d6abc/includes/image.gd.inc on line 97.
# warning: imagealphablending(): supplied argument is not a valid Image resource in /public_html/d6abc/includes/image.gd.inc on line 98.
and so on ....

greggus-1’s picture

subscribe

thamas’s picture

I tried the imagecache for image yesterday with a fresh Acquia Drupal install, but it did not work.

I set image to use imagecache to create the Original, Thumbnail, Embedded sizes. After submitting the dimension set automatically 1x1, and it is not ignored: when I create a new image it is inserted 1px x 1px size. :o(

Geekish’s picture

I had the problem with the 1x1 images too. I found that any time I tried to let imagecache do ANYTHING with the original, it and all my other derived images became 1x1. I had to remove the imagecache preset and let the image.module handle the original image (you can still use the basic scale/scale & crop provided by image.module). All the other imagecache presets worked fine after I changed that back.

Edit: I may have spoken too soon. It seemed to be working fine for a while, but the 1px images are happening again.

Another edit: Okay, now it works again. Sort of. I flushed all the imagecache presets (again), and new images seem to generate derivatives properly.

Problem is, even though all the derivatives show up in the right sizes on the image node, if I try to insert them into a page, then img_assist turns them into thumbnails or 1px images (depending on the browser). Grr. Doesn't seem like an img_assist issue, because if I revert to the image.module presets, the image is inserted at the proper size (after recreating the derivative images). However, when I view the img_assist Filter tags, it gives the dimensions as 1x1 again. So I think somewhere along the line, the imagecache presets are failing to override the image.module dimensions (which I notice become 1x1 when using the imagecache for image module).

Geekish’s picture

In case anybody is curious, I tried a fresh install with a different set-up. In both cases I started with the Image module, Imagecache, and Imagecache for Image (of course). However, instead of using Img_assist (a longtime staple of mine) and FCKeditor for inserting photos, I tried Image Browser and FCKeditor.

Works like a charm so far. No 1x1 images or reducing everything to thumbnails. Of course, imagebrowser is intended to work with both image and Imagecache, so..

Anyway, it looks like Img_assist was the source of my troubles. This new set up allows me to use Imagecache/Imagecache_actions on both image nodes and on images inserted into a text field via FCKeditor, thus meeting both my site requirements (images as nodes and automatic image sizing/watermarking).

Hetta’s picture

Title: Use imagecache as a process for normal image.module presets. » Image size set to 1x1 pixels
Project: Image » Image Assist
Component: image.module » Code
Category: feature » bug
Status: Needs review » Active
dman’s picture

the 1x1 preset was just a workaround because image.module wouldn't allow a preset without dimensions. imagecache actions do not all present a final size in a way that the rest of the image routines expect to see. imagecache is more flexible than was anticipated.

The fix - to allow the possibility that an image.module preset does NOT have a defined size - needs to be fed back to all the contrib modules that used to assume it was always there.
Try 1000x1000 - should work just as well.

I'll take a current checkout of the image* modules and see if there are still problems.

peterjmag’s picture

I need to test this out a bit more, but I'd love to see this module committed to the appropriate project.

sun’s picture

Title: Image size set to 1x1 pixels » Use imagecache as a process for normal image.module presets
Project: Image Assist » Image
Component: Code » image.module
Category: bug » feature
Status: Active » Needs review

Image Assist has nothing to do with this issue.

dman’s picture

To revisit...
I'm doing a heap of image-suite revisions and updates this weekend (lots of docs in the works) and I'd like to see this glue module back on the table.

The bug touched on here is all stemming from the image preset size setting validation step


/**
 * Check that the sizes provided have the required amount of information.
 */
function image_settings_sizes_validate($form, &$form_state) {
  foreach (element_children($form) as $key) {
    // If there's a label they must provide at either a height or width.
    if ($key != IMAGE_ORIGINAL && !empty($form[$key]['label']['#value'])) {
      if (empty($form[$key]['width']['#value']) && empty($form[$key]['height']['#value'])) {
        form_set_error("image_sizes][$key][width", t('You must specify width, height or both dimensions.'));
      }
    }
  }
}

In order for imagecache_for_image to survive, that assumption that all presets return a fixed set of dimensions has to be worked around. Currently quite badly.

If that validation function also checked that the preset process was one of the known 'scale' or 'scale_crop' before setting its error, then the additional imagecache presets (which do not always know their size ) could be inserted into the pipeline without hackery.

If image.module allowed that, I'll do a re-roll and see where we are at.
I Do not know of the side-effects further down the track of having a preset with undefined dimensions. Does it give image_get_derivative_sizes() a division by zero? That's why I haven't tried harder.

.dan.

luco’s picture

I'll test it any patch you post here. I need this integration working ;)

dman’s picture

With the November version I've tried again, and it still works just fine out of the box - with todays checkouts of imagecache & image.

It seems that this IS all about img_assist! That's the only situation that I see reports about.

image module didn't mind having dummy values in the size array, but it seems that img_assist is requesting them and using them.
No img_assist, no problem.
This implies that any change will have some sort of downstream effect, and require a patch to img_assist!

I'll see what needs to be done to allow null dimensions to work within image.module, then we'll have to let img_assist.module know that it needs to allow for that.

dman’s picture

Here is a re-roll
- the November version wasn't broken - it's just that img_assist (and possibly other extension modules) assume that image.module presets always have a known, fixed size.
I don't know what to tell them, when imagecache presets may have a width of '40%' or a canvas adjustment of '+20px'. They need to deal with a variable-sized preset.

This update includes a lot of tweaking. Importantly it now requires a patch to image.module that allows image.module operations to actually delegate to other modules.
The built-in image.module [scale, scale_crop] operations are hardcoded and limited. This patch attempts to fix that.

@@ -817,6 +824,14 @@ function _image_build_derivatives($node,
       case 'scale_crop':
         $status = image_scale_and_crop($original_path, $destination,  $size['width'], $size['height']);
         break;
+
+      default :
+        // Other operations may exist, invoke them by name
+        // If the preset profile contains a 'callback' attribute,
+        // Run that function instead. The function should behave the same as the built-in ones above.
+        if (isset($size['callback']) && function_exists($size['callback'])) {
+          $status = $size['callback']($original_path, $destination, $size['callback_arg']);
+        }
     }

Now... image.module is unlikely to be officially patched in a hurry. New features in D7, ported back, yadda yadda.
But imagecache is into core for D7, so there should be a lot more synergy there. then.

If you want this feature now:
- use the November version, it's OK.
- If that produces problems with 1x1 images or validation complaints, use this version and patch image.module
- or if it's just img_assist that's bugging you, try fixing up img_assist to allow for undefined sizes.

I tried img_assist today, and it won't even place my derivative presets, so I don't know what's supposed to be happening.

joachim’s picture

@dman
Image module will be patched if patches have been tested and the maintainers agree to committing the patch.
I see sun has left this issue as being on 6.x-1.x-dev, so I assume he is in favour of this going into that branch. So am I :)

I've had a super-quick glance at what you've linked in the comment above and the first thing that springs to mind -- if you're patching image.module anyway, why not patch it to add a hook_image_operations, rather than shove your presets in with a hook_form_alter? Then image.module implements it, and so does your module. (And perhaps others, who knows?)

dman’s picture

Good thoughts. I hadn't got that far ahead.
The history of this thing (heh, a year old this month) started off as an attempt to do something that worked but did not need code changes to either other modules. I guess I didn't get out of that mindset enough.

You are totally right that if image.module image processing is to allow 3rd party operations, then the form options should have that extensibility built in. The stupid things I've had to do via form alter could be chopped back down to three lines. Or rather, as you say, just an info hook.

obvious, thankyou. I'll have a look at that.

mafioso’s picture

subscribe

pvhee’s picture

subscribe

asb’s picture

I lost Imagecache integration when "upgrading" from image module 5.x-2.0-alpha3 to 6.x-1.0-alpha4 and would like to get it back. subscribing ;)

Greetings, -asb

dman’s picture

I've got an updated stream of this function available at
http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/dman/imagec...
I use this. You can keep up with this if you like. It works. So far. :-/

PlayfulWolf’s picture

can anyone at last combine this peace of code into these modules???

Drupalized’s picture

subscribe

tevih’s picture

subscribe

and are people trying to make this work for both D6 and D5? I'm on 5.

Drupalized’s picture

@tevih i'm here for Drupal 6 and this issue also assigned to 6.x-1.x-dev

joachim’s picture

@tevih New features are implemented on D6. Once that is done, we can think about a backport.

asb’s picture

@joachim, @tevih:

> New features are implemented on D6. Once that is done, we can think about a backport.

I'm getting very confused. The functionality dman is developing for D6 (integrating imagecache presets into the image module) exists for D5 for quite a while, at least I have a sub-module "ImageCache 4 Image" running in version 5.x-2.4 that works pretty well; according to /admin/build/modules, that module belongs ImageCache (does it? 437966). So I don't quite understand why it would be necessary to backport this (very cool!) feature since it seems to already exist...

A second thing I don't understand is the relation of the (latest) 5.x-2.0-alpha3 branch to the (latest) 6.x-1.0-alpha4 branch; if new features are developed for D6, I don't understand how this branch (with more features than the 5.x-1.x branches) came into existence; as far as I can see on my D6 sites, stuff like Image Galleries through views does not exist in the 6.x-1.0 branch yet while it is working quite nicely in the 5.x-2.0 branch already.

Sorry, but I'm really confused about this...

@dman:

I tried the imagecache_image module together with ImageAPI 6.x-1.6, ImageCache 6.x-2.0-beta9, and Image 6.x-1.0-alpha4:

  1. Created a folder ./sites/all/modules/imagecache_image/
  2. Copied imagecache_image.info and imagecache_image.module into this folder
  3. Downloaded image-operations_hook-20090419.patch into ./sites/all/modules/image/ and applied the patch
  4. Applied Imagecache's presets at ./admin/settings/image/nodes

Parts of the patch are rejected:

$ cat image.admin.inc.rej 
*************** function image_settings_sizes_validate($
*** 110,117 ****
    foreach (element_children($form) as $key) {
      // If there's a label they must provide at either a height or width.
      if ($key != IMAGE_ORIGINAL && !empty($form[$key]['label']['#value'])) {
-       if (empty($form[$key]['width']['#value']) && empty($form[$key]['height']['#value'])) {
-         form_set_error("image_sizes][$key][width", t('You must specify width, height or both dimensions.'));
        }
      }
    }
--- 110,120 ----
    foreach (element_children($form) as $key) {
      // If there's a label they must provide at either a height or width.
      if ($key != IMAGE_ORIGINAL && !empty($form[$key]['label']['#value'])) {
+       // Only validate our own known operations, allow for other operations to be available without defined dimensions
+       if (($form[$key]['operation']['#value'] == 'scale') || ($form[$key]['operation']['#value'] == 'scale_crop')) {
+         if (empty($form[$key]['width']['#value']) && empty($form[$key]['height']['#value'])) {
+           form_set_error("image_sizes][$key][width", t('You must specify width, height or both dimensions.'));
+         }
        }
      }
    }

However, the Imagecache intregration appears to work quite well.

What can we do to get this into an official/packaged release, either inside the image module's contribs or as separate project?

Greetings, -asb

joachim’s picture

@asb:

- I don't know all the details of the feature in question here. Policy is to develop on the most recent version first. If something already works on 5 then great.
- about the branches: drewish began working on the 5-2 branch before Drupal 6 was released. I contributed the views stuff for image gallery. Then Drupal 6 was released, it took a long time for Views 2 to be released, and it took me a long time to get image support into galleries. There is now a patch for this by the way :)

joachim’s picture

I would say what needs to be done for this to be included is just the changes outlined in #66.

I don't know if this module is best kept as a contrib in image or imagecache, but I'm happy to have it here. Let's see what the other maintainer thinks :)

dman’s picture

@asb thanks for the feedback.
I imagine image.module may have changed a little bit there in the last month. I'd advise you try to apply those missing lines by hand, because it does eventually have a pointless side-effect of not allowing you to route image derivatives through imagecache if you don't also add a (useless) dimension to the UI. This issue has popped up repeatedly in trying to keep up.

I think that postponing it all until D7 will be disappointing. The thing is, First we need both image.module and imagecache.module to be stable on D7 - then I could look at bridging the gap again. Because neither image.module or imagecache.module currently 'owns' this bridge, it's always falling through the cracks.

The patch I've put in there could, I guess be proposed for image.module D7. It is deliberately and carefully non-invasive, and just opens up a bit of room for this callback.
BUT

  • With no imagecache for d7 available, this is impossible to test in D7.
  • Therefore I can't really propose or put this new feature into D7.
  • Therefore we are not allowed to put it into D6.
  • Even though it (something similar) worked in D5.
  • :-(

Yeah, this is a bit of a Catch-22.

Either I propose it to D7 with no test case or proof-of-concept. Unlikely?
Or we maybe eventually look at it again after imagecache goes stable on D7. :-C

If I thought there was a chance of this happening, then I'd be suggesting that image.module derivative building be reworked quite a bit to support this abstraction natively (and treat its own scale functions as callbacks alongside our new ones). But I don't know if that would be popular or possible.

scroogie’s picture

I thought that imagecache (API) is going to core in D7?

BartVG’s picture

reply to http://drupal.org/node/231622#comment-857078

Apart from this transparancy, what's the use of creating static derivatives through ImageCache? I thought that ImageCache was all about generating derivatives on the fly and thus removing the clutter of having an_image.preview.jpg, an_image.thumb. jpg, an_image.blablabla.jpg, an_image.so_and_so.jpg, etc.

When I came across this issue, I thought that this would finally suit my needs, i.e. using Image module (+ Image Gallery and Image Assist) but with dynamically generated derivatives from ImageCache.
Alas...

Are there any objections to this idea? Would it be so difficult to alter all the Image dependent modules to use ImageCache?

Quick idea: route the requests for a certain file to a function that determines whether to take a file from disk or to generate a derivative.

function get_image($filename){
  global $conf;
  //general form of file name: [name].[preset].jpg
  if (!exists($filename)) {
    if(module_exists('imagecache')){
      $parts = explode($filename, '.');
      $preset = $parts[1];
      $path = $conf[$preset];
      return "{$path}/{$parts[0]}.{$parts[2]}";
    }
  } else {
    //get file from file system
  }
}

I don't know the inner workings of ImageCache or the Image module, so this piece of code may utterly useless.

freddyseubert’s picture

+1 for imagecache_image

just subscribing.

vhenninot’s picture

Hello,

I would like to use imagecache 4 image, but i don't know how to patch original image module file with image-operations_hook-20090419.patch !

I understand that we have to modify these files by hand :
modules/image/image.admin.inc
modules/image/image.module
modules/image/contrib/image_import/image_import.pages.inc

But i'm not familiar with diff files found here http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/dman/imagec......

=> have i to remove line with "-" and add line with "+" ?
I will try that... and post here again...

Regards,
Vincent

vhenninot’s picture

OK, Great !
Work just perfectly !

but no file created in imagecache subfolder...
is it normal because file creation is handled by image module ?

Vincent

vhenninot’s picture

Working BUT not for original image !

I created 3 presets for original (resize to 1280pixels if image is larger than that), preview and thumbnail.
Preview and thumbnail images are successfuly created, but NOT the original one !

I have the original image file i uploaded, but not the "original" file that imagecache should create with my original "preset"...

Could anybody help me with that problem ?

Regards,
Vincent

dman’s picture

#1 - in order to integrate correctly with assumptions all other modules (like lightbox, and image itself) make about presets - the derivative image is saved in the normal place images/imagename.preview.jpg - not in the imagecache directory.

#2 'original' means always original. It is never modified. The UI should probably take care to disable that option and make it clear that changes will not apply to the original.

vhenninot’s picture

Hello and thanks for your answer !

For #2 the drupal image module original behavior was to scale to height x weight fixed in the "original" image "label".
with that behavio it is possible tu upload uge image file but to scale and autorotate them to "normal 1280x1024" resolution...

So question is HOW could we handle original image file ?
We could not use original image moodule scale because it does not recognize EXIF, and don't autorotate files...
(autorotate with imagecache action in dev module)

Thanks again for your quick answer,
Regards,
Vincent

dman’s picture

Really? Something must have changed since I last looked. I thought original was retained absolutely, because when next re-generating the derivatives, we don't want to be starting from an already-mogrified source.
(Bad things happen if you watermark your 'original' and then generate a watermarked 'preview' from that)

In your case, I'd create a 1280px 'screensize' derivative, and use that where you were previously using _original.
I'm not sure that the code should be changed to modify the 'original' - I see serious data loss possible if you do that. Imagine what would happen if you scaled the 'original' to 50% :-}

vhenninot’s picture

You can see just above the image size boxes : Note: 'Original' dimensions will only be used to resize images when they are first uploaded. Existing originals will not be modified.

The original image is modified if we put values in height and weight !
My Goal is to prevent keeping too big jpg files... that why i want to downscale image (if necessary)

The only solution is use original drupal image sacle... but then loosing autorotate... not possible...
AAAhhhhh !!
:o(

Thanks for your help !

Regards,
Vincent

vhenninot’s picture

dman, if you know, how to disable the UI check, or just know where to search... tell me !
Because with autorotate it is more important to use the first derivative rotate correctly than the original !
Vincent

vhenninot’s picture

I think it could be here, in image.module :

$all_sizes = image_get_sizes(NULL, $image_info['height'] / $image_info['width']);
foreach ($all_sizes as $key => $size) {
// We don't want to include the original.
if ($key == IMAGE_ORIGINAL) {
continue;
...
Vincent

marcus178’s picture

I was look to apply this patch to 6.x-1.0-beta3 but assuming that won't work as the code seems to be all different. Is that correct?

joachim’s picture

I confess I no longer have any idea what this issue is doing.

I wonder whether the best thing would be to work in a new 6.x branch on the conversion of image module to be a simple wrapper for imagefield+imagecache. This would mean an upgrade script to convert all image data to CCK and the preset data to imagecache.

scroogie’s picture

Perhaps that would be a good idea. It could also have a successor to image_attach through filefield_sources, with optional integration of img_assist/imagebrowser, or a successor for image_gallery either taxonomy- or views-based.

Scott J’s picture

Status: Needs work » Needs review

I think that this is a great idea. Please start a 6.x-3.x as soon as possible. It seems that the conversion scripts have already been written, such as http://drupal.org/node/432860 and http://drupal.org/node/201983, so why not make it official?

A new branch would then give direction to the dozen or so other modules that depend on Image, so that they can upgrade in an orderly manner. I see that someone has already forked img_assist module on their own, to become imagefield_assist; this has got to be a bad thing in the already confused state of Drupal image support.

With Drupal 7 on the horizon, it becomes all the more important for Image to be all tidied up and 'standardised' ready for more conversion at that point. And just think, your support queue should be much shorter for a wrapper/helper/glue module, as problems can just be reassigned up to the parent modules!

Image module has withstood the test of time, proving that a lot of people find it useful to have a single integrated, all-in-one place to go for images, attachments and galleries, so I would hate to see it lose momentum now by people looking for a 'more modern' or standard/cck method for their sites.

Status: Needs review » Needs work

The last submitted patch, imagecache_image-form_integration_tweaked.patch, failed testing.

grub3’s picture

I would love to have this patch.

David Stosik’s picture

Status: Needs review » Needs work

Subscribing. :)

ManyNancy’s picture

Subscribe

panhead490’s picture

Subscribe

joachim’s picture

For reference, here's what I explained to panhead on IRC just now about what I meant in comment #66 above:

[21:32] joachim_: what I mean is create a new hook
[21:32] joachim_: same idea as something like hook_node_info
[21:33] joachim_: it merely asks modules "what image operations do you provide?"
[21:33] joachim_: image module would then say 'scale, crop'
[21:33] joachim_: this new module in the patch would say 'I have all these shiny imagecache presets'
[21:33] joachim_: the form would invoke the hook to discover the possible presets and use that data to populate the dropdown
[21:34] joachim_: the hook would need to return: name, label, some sort of callback so image module knows how to make it happen, and as we've seen, whether you want x*y imension fields
[21:35] joachim_: so it does involve ripping up a chunk of image.module

dman’s picture

Revisiting.
image.module DRUPAL-6--1 (dev) http://drupal.org/node/94674 April 22, 2010
imagecache.module DRUPAL-6--2 (dev) http://drupal.org/node/96391 2010-May-30

The patch looks a little big, but it's mostly modifications to the UI, changing the validation rules to let through the new options, and a large amount of inline documentation, so it becomes its own API docs.
I modified image.module to actually publish and invoke its OWN scale and scale_crop actions using the same methods, which was slightly abstract, BUT it means that everyone uses the same process now. Image.module stil works just fine without imagecache, it just talks to itself through the new hook_image_operations()

Thanks to panhead490 for providing me motivation to do this again - properly this time!

I found 70 coder style errors pre-existing in image.module -dev which I'd like to tidy up also if I'm allowed, but I'll not do that until someone can review and let me know if my hooks etc I'm inserting have a chance of being accepted...

Here's the juice, the hook and the callback image.module now use to build images:

<?php
/**
 * Implementation of (our own) hook_image_operations().
 *
 * Declare the operations we make available for use as derivative sizes.
 * Returns an array of operation definitions, keyed by operation id.
 *
 * The operation definition may contain the keys:
 *   'name' => "Human-readable name for this action",
 *   'module' => "Name of the module that provides the operation"
 *   'callback' => "Name of the function that performs the operation"
 *   'extra'   => "If present, it may provide some additional information about
 * the operation, such as a link to its configuration page"
 *
 * See _image_build_derivative() for the "callback" function signature.
 *
 * @return an array of image operation definitions.
 *
 * @see image_admin_settings()
 */
function image_image_operations() {
 
$operations = array(
   
'scale' => array(
     
'name' => t('Scale image'),
     
'module' => 'image',
     
'callback' => '_image_build_derivative',
    ),
   
'scale_crop' => array(
     
'name' => t('Scale and crop image'),
     
'module' => 'image',
     
'callback' => '_image_build_derivative',
    ),
  );
  return
$operations;
}
/**
 * Generate a single image derivative. Invoked as a callback from within
 * _image_build_derivatives().
 *
 * @param $original_path
 *   Source image
 * @param $destination
 *   Save image as
 * @param $derivative_info
 *   An array of data that image.module settings form may save. Normally
 * this includes the derivative name, operation id, and width and height.
 * $derivative_info['operation'] will be of the form 'imagecache-n' where n is a
 * preset id that we will build
 *
 * @see _image_build_derivatives()
 */
function _image_build_derivative($original_path, $destination, $derivative_info = array()) {
  switch (
$derivative_info['operation']) {
    case
'scale':
      return
image_scale($original_path, $destination, $derivative_info['width'], $derivative_info['height']);
    case
'scale_crop':
      return
image_scale_and_crop($original_path, $destination$derivative_info['width'], $derivative_info['height']);
  }
  return
FALSE;
}
?>

This method now replaces the 'switch' that was in the middle of _image_build_derivatives()

I think I've worked through all the issues I encountered last time with the validation complaining sometimes when the image settings form was being submitted. AND I added in proper support for rebuilds, so that changes in a preset will propogate back to the derivatives saved elswhere.

:-)
Share and enjoy!
Or at least review!

Status: Needs review » Needs work

The last submitted patch, imagecache.image_integration.20100604.patch, failed testing.

joachim’s picture

> I found 70 coder style errors pre-existing in image.module -dev which I'd like to tidy up also if I'm allowed

In haste, just seen this as about to leave... don't include extra tidying up in a patch; it makes it much much harder to review.

dman’s picture

Status: Needs work » Needs review
FileSize
11.26 KB

I probably built those patches from the wrong directory (above the actual module). :(
Not sure what the bot thinks about applying patches to a module that's different from the queue ;-)

I'll try again, but I think I need to go find the testbot instructions ...

dman’s picture

"don't include extra tidying up in a patch"
Certainly not - this one is scary enough already!
But it wasn't until I was done that I ran the review and noticed :-)

I'll commit to fixing that for us immediately next ... if you can look favorably on this initiative ;-)
It got a bit stalled last time hanging in limbo between the two modules both in active development. It doesn't make a lot of sense unless we can get this bridge into BOTH projects at once.
Deal?

joachim’s picture

Does this need work to happen on imagecache too?

dman’s picture

Yes, that's the second patch file.
One makes image.module use hooks, another makes imagecache invoke said hook.

joachim’s picture

I reckon you can put that in imagecache_image and add that as a contrib module here.

dman’s picture

95%, yes, true.
It would certainly be more convenient to have it all in one project.
The one thing it's missing is a way to notify image.module that the imagecache preset has been changed and thus the derivative needs a rebuild.
There's no hook in imagecache to catch that.
Previously I added a #submit action with form_alter to catch when an imagecache preset was being saved, but that still had some holes. I need to capture the imagecache 'flush preset' event.

If I can just get that in - it would require abstracting a little bit more - to imagecache, then yes, I'd love for the bridge functionality to live in one place. We failed to find a home for it last time I tried...

I was also thinking of making the integration optional - but it only made sense if making it optional from the imagecache side. The things needed to do to image.module were so much in the middle of things (but only adding hooks) that turning off hook functionality was no win.
So ... if the remaining bits lived an imagecache-bridge within image.module .. that could work, yeah.

AntiNSA’s picture

subscribe

izmeez’s picture

subscribing

hswong3i’s picture

subscribing

joachim’s picture

Status: Needs review » Needs work

It's going to be a few weeks before I have enough time and a clear enough head to properly review this, but here is a very quick review just from a read of the code:

- rather than call the hook again to get $our_operations, I would add a key to what the hook returns, like:
'needs_dimensions' => TRUE,
It's unlikely that any other module implementing this hook would need dimensions too... but it makes the code that little bit smoother, as you just test that value when you iterate the operations to see whether to build the height and width form elements.

(We could even have each operation specify names of form elements it wants, and therefore hypothetically allow other hooks to say they want a text field there, but I think this is overly complex and is never going to be used!)

Similarly in the validation handler, there's probably no need to call the hook again to see which operations need those values checking -- just look in $form to see if that operation has those in the first place.

_image_build_derivative() vs _image_build_derivative() -- avoid having two function names differ by a plural like the plague! it makes code harder to read, trips you up unless you've noticed both exist, and is an invitation to make typos.

Also:

> + * CHANGELOG - this was using $form[...]['#value'] where it should have been
+ * using $form_state['values']. Changed it to behave normally, but unsure if the
+ * previous method was intentional. - dman

I've a feeling that's D5 code that never got updated. Could someone file an issue with this and check in old FormAPI docs if that's the case? We should fix this as a separate patch.

dman’s picture

It's unlikely that any other module implementing this hook would need dimensions too

yeah, it was a bit of an assumption.
I can't see any 'other' module being able to couple any closer than this either, but at least a flag would remove any assumptions.

I had pains with the validator getting in the way every time I tried this sort of patch (2 years and counting now I think). The extra check may be overkill or left over from a different version.

_image_build_derivative() - I'll need to revisit what was happening there. Point taken, but there was a reason.

I think we can discard the old $form[...]['#value']. It looked like a left-over.

joachim’s picture

> at least a flag would remove any assumptions.

It's more about making the code simpler and easier to read :D

> I think we can discard the old $form[...]['#value']. It looked like a left-over.

I think so too, but I'd prefer this got fixed in its own issue.

a_d_jackson’s picture

Status: Needs work » Needs review
joachim’s picture

Status: Needs review » Needs work

No, it needs work. The current patch has already passed tests.

dman’s picture

If that minor code style repair is a blocker, here's a new issue for it.
#841680: image_admin_settings_validate() was inspecting $form[...]['#value'] inappropriately
So this issue is now pending that one.

joachim’s picture

Thanks for filing that and rolling the separate patch. I've committed that fix.

ElGringo’s picture

Status: Needs work » Needs review
MBroberg’s picture

Status: Needs review » Needs work

subscribe

- for people just joining this 2-year thread, do we have any (semi)working code, and do we apply it to both modules? This is so needed - thank you!

MBroberg’s picture

Status: Needs work » Needs review

oops sorry, I did not mean to change any status

joachim’s picture

Status: Needs review » Needs work

AFAIK the patch needs work because we fixed a problem in another issue, and also for the other things I mentioned in comment #116.

dman’s picture

Right. So now that's through I should try a re-roll :-)
I'll give it a go again.

dman’s picture

Status: Needs work » Needs review
FileSize
4.79 KB
11.78 KB

Here's a re-roll of #107.

Revised as per joachims comments #116

There is no more _image_build_derivative(s) confusion. Now the two callback stubs
_image_build_derivative_scale()
_image_build_derivative_scale_and_crop()
are not crammed into one switch statement, they are individual, small callbacks.

Even when I was first doing it, I was tempted to abstract the 'dimensions' form elements into a callback or FAPI snippet to allow different presets to put different settings there ... but I agree that will be unused, and would mean messing with the layout more than I want to. Plus I'd need to put the validation into smaller callbacks and get messy. So we'll still just have the base actions with either a setting that has dimensions and 'others'. Using the flag as suggested.

For the validation handler, just inspecting whether the form element exists, without first checking whether the form element should exist (by retrieving the operation definitions first) seems like pretty weak validation. But I'll try it, using both isset() and empty().

... and ... no, actually that can't work. It makes it impossible to switch between operations that do and don't require dimensions.
I NEED to look at the submitted requested operation['needs_dimensions'] before deciding whether height x width needs validation.
... dammit. Now I can't switch back either. The form doesn't rebuild to adjust to conditional validation requirements if I throw an error first. I also tried shifting the individual rows validation into an element_validate callback but found the same problem.

- so this current version has a small gap in the validation if you switch from a third-party preset back to an image.module operation - it allows you to do so without immediately forcing you to enter new valid dimensions.
If anyone can suggest how to do conditional FAPI validation with required fields that come and go I want to know, I searched for an hour but couldn't do it.

Against todays DRUPAL-6--1 -dev.

Results from applying this patch should be entirely transparent. You'll see no difference in behavior at first.

To make the changes work, we also need the second patch in imagecache itself that will advertise the extra options that will then become available in the image settings. I'll attach the patch but as it applies to imagecache project (also todays dev, DRUPAL-6--2), it will probably fail against testbot here.

When BOTH patches are applied, we get the UI changes illustrated in #104

Status: Needs review » Needs work

The last submitted patch, imagecache.image_integration-20100714.patch, failed testing.

dman’s picture

second failure as expected. Only the first one counts for this module

joachim’s picture

Wow. I'm impressed -- within moments of applying these patches I had a desaturated photo showing in my image node!

Now for the detail...

+++ image.admin.inc	14 Jul 2010 02:43:21 -0000
@@ -77,20 +88,33 @@ function image_admin_settings() {
+      $operation = @$operations[$size['operation']];

Too many @s in here. They're odd and scary, and as much as I hate how wordy PHP gets with endless checks to isset() and empty(), we should use those.

Here, I assume we're allowing for the fact that there might not be an operation for the current form element, in the event that a module has been uninstalled?
In which case, we can test for that in the else just above -- I've made that change in my version of the patch.

+++ image.admin.inc	14 Jul 2010 02:43:21 -0000
@@ -77,20 +88,33 @@ function image_admin_settings() {
+        '#default_value' => @$size['height'],

No need for the scary @ -- the size key is always set, just it may be an empty string. Changed that in my patch.

+++ image.admin.inc	14 Jul 2010 02:43:21 -0000
@@ -172,7 +204,7 @@ function image_admin_settings_submit($fo
+        $rebuild |= (@$form_state['values']['image_sizes'][$key][$field] != @$old_sizes[$key][$field]);

This is scary too.

Can we expand this, or wrap in a test on ['needs_dimensions'] ?

+++ image.module	14 Jul 2010 02:43:22 -0000
@@ -787,6 +787,73 @@ function _image_check_settings() {
+function _image_build_derivative_scale($original_path, $destination, $derivative_info = array()) {
+  return image_scale($original_path, $destination, $derivative_info['width'], $derivative_info['height']);

Why don't we just change the signature of image_scale() and use it directly?
Ditto scale and crop.

- return FALSE;
+ //return FALSE;
+ // One failure may not mean that we should give up entirely. Make the other derivatives anyway.

Just kill the return line if it's not needed, though having the comment to explain what we're doing is good.

+ $operations = module_invoke_all('image_operations', TRUE);

What's the TRUE for?

> - so this current version has a small gap in the validation if you switch from a third-party preset back to an image.module operation - it allows you to do so without immediately forcing you to enter new valid dimensions.

Ah, yes, I see what you mean. This is where ideally we'd have the widthxheight portion of the form AJAX itself in. Which I doubt anyone has time to implement, so I'm happy to leave it as is.

Also, the doc header for image_image_operations() needs some work -- probably put the array details in the actual @return bit -- but it's breakfast time here :)

dman’s picture

Well at least it worked!!

@s are a bit of a concern, but in this case they are mainly there for legacy/upgrade smoothness. First install of this version onto a running site would complain until you'd saved the settings once. I always run with E_ALL (as you can guess) and I've spent swathes of my Drupal time eliminating warnings in contrib.
In this case it's a conscious choice - I fully expect some indexes to be undefined sometimes and that's OK and @ is just succinct.
But yeah, we can add another handful of isset()s around the place, just to be really thingy about it.

No need for the scary @ -- the size key is always set

It was complaining during dev for me... $size['height'] can be undefined if switching back from an external operation. But a really trivial notice if so, so I ignored it quickly.

Why don't we just change the signature of image_scale() and use it directly?

Yeah I looked at that. reason: because it's core. includes/image.inc. Not gonna go there.

+ //return FALSE;
Sorta debug FYI. I was about to del it then thought the comment was left out of context, so hesitated. Just cruft now.
I've encountered a number of reasons imagecache processes can fail, so I've tried to deal with that case.

+ $operations = module_invoke_all('image_operations', TRUE);
What's the TRUE for?

An earlier iteration had image_operations returning a pre-filtered list of just the form-select option array. I retired that idea, that must be a left-over we can remove.

This is where ideally we'd have the widthxheight portion of the form AJAX itself in

I was floating on the fringe of going AJAXy with this, but it meant too much surgery on the current form. For very limited utility (and still validation pain). So we'll live with it.

Also, the doc header for image_image_operations() needs some work

True. The docblock and API definition floated around between various files as it developed. Never quite found the right home for it. Has been a work in progress. I think we are supposed to add an image.api file to declare and document it or something, but that seemed a bit of a reach for now.

joachim’s picture

> But yeah, we can add another handful of isset()s around the place, just to be really thingy about it.

I think isset()s are the best of two bad options.

> Yeah I looked at that. reason: because it's core. includes/image.inc. Not gonna go there.

Oops. I acked it in the code and thought I saw it defined in the module.

Having two functions that are mere wrappers seems a bit wasteful. If you want to switch back to a single wrapper that switches, I'm fine with that -- it was just the actual name of the function I didn't like.

> Sorta debug FYI.

:D

> I was floating on the fringe of going AJAXy with this, but it meant too much surgery on the current form.

Yeah. Let's leave it, and if someone wants to have a go implementing some basic form ajax, they can tackle it in a subsequent patch. The gain in functionality here is definitely worth a minor UI glitch.

> True. The docblock and API definition floated around between various files as it developed.

An image.api file is part of the spec for D7. Not needed here yet.
What I meant is that the array you return should be laid out in the actual @return thingy. Look at http://api.drupal.org/api/function/hook_menu for an example.

dman’s picture

I'm well in favor of some isset()s. Was just looking for some shorthand to make the patch less intimidating really.

Having two functions that are mere wrappers seems a bit wasteful

... The code actually ended up more concise with two trivial stubs! And it's marginally better-practice (not overloading one stub) and a better illustration of the way the API works. So I'm pleased with this alternative. Coming back to it after a week/month showed me there was no compelling reason to scrunch them together.

I'll get your patch down and see if I can over-document the docblock. (I'm way too wordy sometimes)

joachim’s picture

> Coming back to it after a week/month showed me there was no compelling reason to scrunch them together.

Ok let's keep that as two stubs then.

sun’s picture

+++ image.admin.inc	14 Jul 2010 07:18:08 -0000
@@ -110,12 +137,20 @@ function image_admin_settings() {
   $image_sizes = $form_state['values']['image_sizes'];
...
-    if ($key != IMAGE_ORIGINAL && !empty($image_sizes[$key]['label'])) {
-      if (empty($image_sizes[$key]['width']) && empty($image_sizes[$key]['height'])) {
-        form_set_error("image_sizes][$key][width", t('You must specify width, height or both dimensions.'));
...
+    if ($key != IMAGE_ORIGINAL && !empty($size['label']) && !empty($operation['needs_dimensions']) && isset($size['width']) && isset($size['height'])) {
+      if (empty($size['width']) && empty($size['height'])) {
+        form_set_error("image_sizes][$key][label", t('You must specify width, height or both dimensions.'));

The previous code rightfully tested values that have been submitted; the new code checks already stored values.

+++ image.admin.inc	14 Jul 2010 07:18:08 -0000
@@ -110,12 +137,20 @@ function image_admin_settings() {
+    // If there's a label they may be required to provide at either a height or width.
+    ¶

Trailing white-space and comments exceeding 80 chars here and elsewhere in this patch.

+++ image.admin.inc	14 Jul 2010 07:18:08 -0000
@@ -172,7 +207,7 @@ function image_admin_settings_submit($fo
       foreach (array('operation', 'height', 'width') as $field) {
-        $rebuild |= ($form_state['values']['image_sizes'][$key][$field] != $old_sizes[$key][$field]);
+        $rebuild |= (@$form_state['values']['image_sizes'][$key][$field] != @$old_sizes[$key][$field]);
       }

Error suppression is slow and poor code. Here, the inner foreach can be wrapped into a condition with two isset()s.

+++ image.module	14 Jul 2010 07:18:10 -0000
@@ -787,6 +787,73 @@ function _image_check_settings() {
+ * The operation definition may contain the keys:
+ *   'name' => "Human-readable name for this action",   ¶

See http://drupal.org/node/1354 for formatting standards for lists.

+++ image.module	14 Jul 2010 07:18:10 -0000
@@ -847,24 +919,35 @@ function _image_build_derivatives($node,
+    if (empty($operation)) {
...
+      watchdog('image', 'When building image derivative %key, it appears that the image operation %operation is invalid. Perhaps it depends on an unavailable module. Not building this derivative image.', array('%operation_name' => $operation['name'], '%key' => $key), WATCHDOG_ERROR );
+      $status = FALSE;
+    }
+    if (!empty($operation['callback']) && function_exists($operation['callback'])) {
...
+    }
+    else {
+      watchdog('image', 'When building image derivative %key, it appears that the image operation %operation is invalid. Could not access the callback function [%operation_callback] to process the image. Not building this derivative image.', array('%key' => $key, '%operation_name' => $operation['name'], '%operation_callback' => $operation['callback']), WATCHDOG_ERROR);

Two watchdog messages will be fired here.

+++ image.module	14 Jul 2010 07:18:10 -0000
@@ -847,24 +919,35 @@ function _image_build_derivatives($node,
     if (!$status) {
       drupal_set_message(t('Unable to create scaled %label image.', array('%label' => $size['label'])), 'error');
-      return FALSE;
+      //return FALSE; ¶
+      // One failure may not mean that we should give up entirely. Make the other derivatives anyway.
     }

The return is required to prevent PHP warnings for attempting to work with a non-existing file.

Powered by Dreditor.

dman’s picture

Status: Needs work » Needs review
FileSize
11.89 KB

The previous code rightfully tested values that have been submitted; the new code checks already stored values.

I don't see what you mean.

   $image_sizes = $form_state['values']['image_sizes'];

...

$size = $image_sizes[$key];

...

if (empty($size['width']) && empty($size['height'])) {

That is checking the submitted $form_state['values'] - as intended. It just unpacked it a little more than before.
I may be missing something.

Long comments, yeah. Can chop them out if they are getting in the way. Long comments now multi-line

@error suppression discussed above. We are free to add isset() instead. May make for some long lines.

        $rebuild |= (@$form_state['values']['image_sizes'][$key][$field] != @$old_sizes[$key][$field]);

becomes

        if (isset($form_state['values']['image_sizes'][$key][$field]) && isset($old_sizes[$key][$field]) && ($form_state['values']['image_sizes'][$key][$field] != $old_sizes[$key][$field])) {
          $rebuild = TRUE;
        }

(ugh) but done I feel that might not be quite as logically good though... also need the case if one is not set then there is no match so it should be rebuilt?

docblock formatting discussed above. Can be improved indeed.
reformatted although my IDE (Eclipse) really doesn't like to let me do that layout without 'correcting' it :-/

Two watchdog messages will be fired here.

Hm. Is getting two related warnings a huge error?
'operation' may only be blank during the upgrade? If ever. May need to add an update step to ensure the presets are re-saved at least once. Probably just verbose paranoia though.

OK, added an extra 'else' to avoid the second message on first failure.. Cross fingers that situation never arises I guess.

The return is required to prevent PHP warnings for attempting to work with a non-existing file.

Hm. Should error-checking be added elsewhere to prevent that possibility closer to the point-of-failure then? I feel error recovery is more robust than immediately giving up.
I think I need to purposely break a few things and create a test case where that will happen. Not sure about that for now.

Patch here, based on joachims #131, with above tasks addressed.

(pre-existing white-space and other code review issues are still endemic throughout the current module, cleanup will be a separate task, as suggested in #106.)

riversidekid’s picture

subscribe

chandrabhan’s picture

subbing for updates

PMorris’s picture

Status: Needs review » Needs work

The last submitted patch, image.imagecache_integration-20100715.patch, failed testing.

PMorris’s picture

I think this patch doesn't work anymore? I got 1 out of 3 hunks FAILED when I tried to apply to the latest development release.

joachim’s picture

That is most probably because of the code clean-up patch that was committed last week.

Can someone reroll this?

Poieo’s picture

Subscribing...

BEfH’s picture

Is there a chance that this issue will get into the 1.0 release of image?
by the way - Great work so far!

joachim’s picture

@145 see #143.

dman’s picture

Status: Needs work » Needs review
FileSize
11.64 KB

re-roll. Still works for me

onyxnz’s picture

Hey dman! Just applied patch #147, but not getting any change in the module's ui. No other options for image manipulation.
Ran the update.php. Also deselected Image module, then reapplied. Any ideas?

dman’s picture

see http://drupal.org/node/231622#comment-3199192
You need to patch BOTH image (to support the change) and imagecache (to publish the change) before you'll see results.
This is part of the problem and why this is taking years to get in. The two modules become interdependent. Well, no actually dependent, but the patch does nothing until BOTH modules are patched up. The good news is that both patches have no negative side effects. The bad news is that neither has any positive effect unless both happen.
This issue is swapping between projects, as the testbot can't do this two-module testing either.

In short, you need #147 on image, AND http://drupal.org/files/issues/imagecache.image_integration-20100714.patch for imagecache.

onyxnz’s picture

Thanks Dman! works for me now :D

dman’s picture

Groovy! Good to hear

AntiNSA’s picture

Question.. .I am using feeds to import feeds and find that the images imported and inclued in the the body of the teaser are breaking my layout because they are too big.is this something that you think that can correct this issue?

Thanks!

dman’s picture

Well, not this.
But my sandbox project:image_ownage addresses this sort of problem.
help (no embedded images in the CVS viewer, sorry, but it's in the module)


... though maybe not with additional preset processing. I can't recall just now, though it probably needed to try to do that...

AntiNSA’s picture

awsome. does your image ownage have a project/module drupal project page?

joachim’s picture

Patch applies and looks good.
Great work, dman. Thanks for all your hard work and persistence on this! :D

I'm going to commit this when I have a spare moment.

I'd like to rework a few of the comments (just nitpicking ;).
If anyone wants to reroll this to remove all the trailing whitespace that would be a huge help.

Further testing of this patch would be appreciated too!

dman’s picture

@AntiNSA No project yet. Maybe sometime later. insert.module came along a few months after I did this, so I wanted to re-evaluate how much cross-over this had with that before releasing.
(not much as it turns out)
Anyway, off-topic, this thread is long enough already...

If your testing on this feature worked for you, can you give us a screenshot or small issue report? Thumbs up?

bluegray’s picture

I have the patches applied to the image and imagecache modules and all seems well.
I am trying to get the module 'Imagecache javascript crop' ( http://drupal.org/project/imagecrop ) to work with my imagecache presets, but it seems to be ignored. I think it might have something to do with a special way the cropped image is called from imagecache. Anyone used the imagecrop module successfully with these patches?

joachim’s picture

@bluegray: Thanks for testing these patches :)

Regarding imagecrop, it looks like that module is going in to alter imagecache images itself -- see this on the project page description:

> at which time your custom cropped version will overwrite the default file at that preset's location in the Imagecache filesystem.

Hence like you say, doing 'something special'. Not something we can support over here. That module should really be hooking into imagecache properly, rather than stepping on its toes to overwrite its images.

sun’s picture

Status: Needs review » Needs work

Thanks for your hard work on this!

+++ image.admin.inc	27 Aug 2010 13:52:38 -0000
@@ -60,6 +60,20 @@ function image_admin_settings() {
+  // Allow for third-party modules (imagecache) to add to the ¶
+  // available preset operations. ¶

Minor: Trailing white-space and not using available space of 80 chars.

Trailing white-space happens to be all over the place in this patch, so needs to be fixed elsewhere, too.

+++ image.admin.inc	27 Aug 2010 13:52:38 -0000
@@ -60,6 +60,20 @@ function image_admin_settings() {
+  $operations = module_invoke_all('image_operations', TRUE);
...
+  foreach ($operations as $operation_id => $operation) {
...
+    if ($operation['module'] != 'image') {

It is odd that a module has to specify it's own name in the registered operations. We should use module_implements() here and automatically set the 'module' key for each operation.

+++ image.admin.inc	27 Aug 2010 13:52:38 -0000
@@ -77,20 +91,34 @@ function image_admin_settings() {
+    // Only show size fields for operations that ask for it
+    if (empty($size['operation']) || $operations[$size['operation']]['needs_dimensions']) {

What means the empty($size['operation'])? The comment only explains the latter condition.

+++ image.admin.inc	27 Aug 2010 13:52:38 -0000
@@ -77,20 +91,34 @@ function image_admin_settings() {
+    elseif (isset($operations[$size['operation']])) {
+      // Allow the providing module to put something informative here ¶
+      // instead of the dimensions.
+      $operation = $operations[$size['operation']];
+      if (!empty($operation['extra'])) {
+        $form['image_sizes'][$key]['extra'] = array(
+          '#type' => 'markup',
+          '#value' => $operation['extra'],
+        );
+      }
+    }

Shouldn't this rather be a hook to invoke? Or what is the typical use-case for 'extra'? (could be stated in the comment)

Not sure whether we need this. Looks like it complicates only and isn't necessary for the essential functionality of this patch.

+++ image.admin.inc	27 Aug 2010 13:52:38 -0000
@@ -110,12 +138,21 @@ function image_admin_settings() {
+  $operations = module_invoke_all('image_operations', TRUE);

What means TRUE? Based on the rest of the patch, I guess that's just stale debugging code.

+++ image.admin.inc	27 Aug 2010 13:52:38 -0000
@@ -110,12 +138,21 @@ function image_admin_settings() {
+    // If there's a label, may be required to provide either a height or width.
+    ¶
+    // Note, this validation is weak here now, as it will only validate when ¶
+    // all inputs are as expected. ¶
+    // Checking only 'needs_dimensions' or only width & height makes it ¶
+    // impossible to switch operation types and still validate without a form ¶
+    // rebuild (which I cannot force from here).
+    if ($key != IMAGE_ORIGINAL && !empty($size['label']) && !empty($operation['needs_dimensions']) && isset($size['width']) && isset($size['height'])) {
+      if (empty($size['width']) && empty($size['height'])) {
+        form_set_error("image_sizes][$key][label", t('You must specify width, height or both dimensions.'));
       }
     }

This looks like a wild assumption. I do not really understand the explanation for the "weak validation". I'd expect that defining 'needs_dimensions' will trigger this validation, regardless of whether there is label or any other size property elsewhere.

+++ image.admin.inc	27 Aug 2010 13:52:38 -0000
@@ -172,7 +209,9 @@ function image_admin_settings_submit($fo
+        if (isset($form_state['values']['image_sizes'][$key][$field]) && isset($old_sizes[$key][$field]) && ($form_state['values']['image_sizes'][$key][$field] != $old_sizes[$key][$field])) {

The additional parenthesis around the last condition is superfluous.

+++ image.module	27 Aug 2010 13:52:39 -0000
@@ -787,6 +787,73 @@ function _image_check_settings() {
+      'needs_dimensions' => TRUE,
+      // This indicates that basic width x height fields should be displayed ¶
+      // on the configuration form

The comment should be above the remarked line, not below.

+++ image.module	27 Aug 2010 13:52:39 -0000
@@ -810,6 +877,11 @@ function image_get_derivative_sizes($ima
+    if ($size['operation'] != 'scale' && $size['operation'] != 'scale_crop') {
+      // Not one of our own processess, Always rebuild.
+      $sizes[$key] = $size;
+      continue;
+    }

Hm. I fear that this can easily lead to a performance issue. We've had quite major problems with the rebuilding of image derivatives in the past, mainly caused by needless rebuilds. Most probably, this would have to be a hook.

+++ image.module	27 Aug 2010 13:52:39 -0000
@@ -849,24 +921,38 @@ function _image_build_derivatives($node,
+    $operation = $operations[$size['operation']];
+    // Be very careful not to die if the needed module or setting is missing.
+    if (empty($operation)) {
+      // The module that provides this operation is now unavailable?
+      watchdog('image', 'When building image derivative %key, it appears that the image operation %operation is invalid. Perhaps it depends on an unavailable module. Not building this derivative image.', array('%operation_name' => $operation['name'], '%key' => $key), WATCHDOG_ERROR );
+      $status = FALSE;
+    }
+    else {
+      if (!empty($operation['callback']) && function_exists($operation['callback'])) {
+        $status = $operation['callback']($original_path, $destination, $size);
+      }
+      else {
+        watchdog('image', 'When building image derivative %key, it appears that the image operation %operation is invalid. Could not access the callback function [%operation_callback] to process the image. Not building this derivative image.', array('%key' => $key, '%operation_name' => $operation['name'], '%operation_callback' => $operation['callback']), WATCHDOG_ERROR);
+        $status = FALSE;
+      }
     }

1) The watchdog message reads a bit lengthy. Can we shorten it up to the point?

2) The code's logic can be heavily simplified here by using the following condition in the first place:

if (!empty($operation['callback']) && function_exists($operation['callback'])) {

This leads to a single else condition without duplicate code.

+++ image.module	27 Aug 2010 13:52:39 -0000
@@ -849,24 +921,38 @@ function _image_build_derivatives($node,
     if (!$status) {
       drupal_set_message(t('Unable to create scaled %label image.', array('%label' => $size['label'])), 'error');
-      return FALSE;
+      // One failure may not mean that we should give up entirely. ¶
+      // Make the other derivatives anyway.
     }

Similar to my performance remark above, this makes me a little nervous. As of now, a negative status means that we were not able to generate a derivative, so it does not make sense to try again for any other derivative. We need to retain the possibility of a hard loop cancellation for failures that won't change, regardless of which operation is used.

Lastly, we can only commit this patch if we are 100% sure that all of the current functionality is retained and does not lead to negative or unexpected side effects on existing sites. We also need to take other modules integrating with Image into account, e.g., Image Assist and others, which means they need to be tested manually.

Powered by Dreditor.

joachim’s picture

Thanks sun for your very thorough review. Looks like this patch needs a bit more work than I thought :/ and you're right we should leave it to a 1.1 to finally get 1.0 out of the door.

> We also need to take other modules integrating with Image into account, e.g., Image Assist and others, which means they need to be tested manually.

Yup, I hadn't thought of all the modules that depend on image. We're at the base of a pretty large ecosystem.

However, I think the changes we make should be transparent. The derivative files get created in the same place, with the same data being stored, right?

That said, some manual testing by users of various image ecosystem modules would be great. Could people report back here on which modules they've tried?

Finally, just an aside:

> It is odd that a module has to specify it's own name in the registered operations. We should use module_implements() here and automatically set the 'module' key for each operation.

See #890660: add an alternative way of doing module_invoke_all() which sets a 'module' key in the returned info ;)

dman’s picture

Gah.
Bad whitespace was largely inherited from the original old code (pre cleanup). This particular patch is now approaching three years old. No excuses for it in comments though (though I'd like to blame my IDE)

Yes, to do it totally 100% abstractly, I'd not be special-casing the image.module 'needs dimensions' special behavior at all. In fact, I'd be adding yet another hook to allow modules to define exactly what form elements they want to put into that column.
That - at the time - felt like a pursuit of the perfect over the good, and added complexity that would probably make this patch less approachable (and a few times harder to test).
Given that current behavior is 100% a special-case for image module, leaving a few special cases for image.module in the existing code was the path of least resistance.

empty($size['operation']) is mostly just to reduce warnings for upgraders. This transparently allows the upgrade path to just keep working without warnings if the 'operation' was unset.
Alternatively, this could be in a hook_update instead, that modifies all presets to the new style. Though tidier, that would be several lines longer, and also break expectations of any other module that uses presets (eg, it would invalidate any exportables, patterns or install profiles). So I allow this code to robustly, quietly, self-repair instead.
Similar code style exists in a few places.
OTOH, this problem may have ceased to exist in the last few years the patch has been maturing.

The 'weak' validation arose because strong validation (at the validate phase) would not allow the UI to switch from a preset that required dimensions to one that didn't and vice versa.
It's heavily commented there because I know it's non-perfect, and an alternative algorithm (which I was unable to imagine) may be able to resolve this situation. I could not at the time. Rewrite is welcome.
Needed to test all combinations of saving, re-saving, switching operations, adding or blanking labels. This algorithm is the best I could do when I tried.

// Not one of our own processess, Always rebuild.
Yes, there could some day be an improvement there. Adding another hook - and more to the point - convincing imagecache to tell us whether each image needed to be rebuilt or not was a large undertaking. I can't generically tell if an imagecache derivative really needs a change or not. Updating a watermark logo image, for example - I just couldn't tell whether a rebuild was neccessary. It seemed like I needed to load a history of changes into the imagecache profile just to answer that question.
I left that as a possible room for improvement, nice-to-have - if we could ever get the basic functionality framework in to go forward from.
Point acknowledged, but premature optimization will stall the effort. It will only (maybe) trigger extra performance in folk that are using this new cutting-edge feature. Then we can address it.
The perfect vs the good again. Perfect will take another 3 years.

My watchdog messages do tend to be wordy, yeah. Feel free to reword as you suggest.

As of now, a negative status means that we were not able to generate a derivative, so it does not make sense to try again for any other derivative

In my experience and testing it does (make sense). Basically because complex imagecache actions are more likely to maybe fail than the truly-basic 'resize' options that were available before.
EG, imagecache text action that puts an attribution line on a picture. For whatever reason (a GD upgrade), the ttf font becomes unavailable at a later date. I don't want this relatively minor bug to suddenly mean my site is entirely incapable of showing thumbnails at all.
YMMV, but I put this in because it suited my use-case to gracefully fail rather than die. Besides, I don't see that trying the next process and failing again is anything more awful than slightly preventable. I don't see the distinct advantage in dying early if there is a chance the next phase is just fine.

However, I think the changes we make should be transparent. The derivative files get created in the same place, with the same data being stored, right?

Indeed, that's been the prime motivator all along - and why some of the code (esp the refresh trigger) had to take extra steps to take this into account.
If I'd changed the behavior of image.module at all - this would never fly. This has always been a drop-in enhancement leaving everyone elses (eg lightbox, img_assist) assumptions in place. At least the assumptions visible about the storage of images.
Not sure about any modules that may call internal image.module functions directly though. I've not seen any myself, but it's conceivable.

In order to make this at all palatable/possible/patchable/readable, I've tried to limit it to just 'adding hooks in strategic places' to build from. Leaving the base module still working as much as possible in the old way. Adding the optimizations and nice-to-haves I saw, but had to defer, the 'patch' gets bigger and bigger. I'm trying to move from one working stable point to another working stable point. The perfect future point may be a few revisions further on.

Anyone who can improve on my code is welcome to give it a go! Please, I need help here!

dman’s picture

re-roll against DEV, with points in 159 addressed.

  • Trimmed trailing whitespace from comments.
  • I did NOT add in another layer of abstraction for "needs dimensions". The only use-case now, and for the lifetime of D6 is "image module" or "imagecache module". Image module can treat its own callbacks to self as special cases, it's one line of code vs 15 new lines that will remain unused.
  • Removed support for upgrading - if operation was 'undefined' I assumed it was the old image.module-only behavior and defaulted to old settings. (empty($size['operation'])) Seeing as that extra code apparently confuses things (and would indeed become legacy), and rather than debate it, I removed that robustness. Now anyone trying to apply this patch on a live site must visit and save the image presets page at least once. Maybe this can also be done with a hook_update, though I was hoping to avoid adding new code there.
  • Removed unused callback parameter. Can't recall what it was for.
  • As above, I could not solve the "weak validation" without going all AJAXy with fields that are conditionally required sometimes but not others. Currently it works as needed for all conditions, that's as good as I could do.
    If there is a way to trigger form rebuild in the validation phase, I haven't found it, it seems like form_set_error means we get a cached form instead.
  • I usually put checkpoint statements "If we've got here, this must be the case" inside the conditional for easier scanning, but OK, I've moved the comment up a line.
  • Leaving "always rebuild" imagecache derivatives as the extra logic would be huge, and currently is not provided by imagecache. Can improve later after benchmarking, avoid premature optimization.
  • Leaving the graceful fallback and continue instead of the immediate death behavior in place.
  • Shortened the watchdog message to provide less information.
  • "logic can be heavily simplified" - if you say so. These are two different error conditions I encountered in testing, so two different messages helped debugging. Chopped it down as suggested. Just remember not to disable imagecache extended actions if you are using them in image module from now on. Otherwise it may throw php notices. I usually prefer to write php-strict code, and with that change, this no longer is.
dman’s picture

Status: Needs work » Needs review

testbot - go!

joachim’s picture

> Now anyone trying to apply this patch on a live site must visit and save the image presets page at least once. Maybe this can also be done with a hook_update,

Sounds to me like it could, and it's what hook_update is for.

> I usually put checkpoint statements "If we've got here, this must be the case" inside the conditional for easier scanning

I can't remember what Drupal code standards say on this. Check! If there's nothing stated about this, file a bug :)

this is going to be too late for the 1.0, as we'd really have to roll another beta to get it widely tested. So what I think is best to do at this point is release 1.0 (this week, as soon as I get spare moment, as the minor bug reports seem to have dried up), and then once I've had a proper look at this patch and it's had a bit of testing, commit it to the -dev release and encourage people to try that.

dman’s picture

I can't remember what Drupal code standards say on this. Check! If there's nothing stated about this, file a bug :)

Hardly a bug. The standards do say comment before the code, and that's fine.

Comments before an if describing the conditional are almost tautologous, as it repeats what is about to be checked.
I put a comment inside the if to describe why something is being done then.

..
.. although I see I misread the review note anyway :-)
It was referring to the code snippet above the one I 'fixed'. Confusion reigns. NVM.

I only bumped this today as I was doing a site transfer and minor version upgrade and thought I'd freshen it. If I get really bored I'll try to think of some tests for it. Really bored,

mcaden’s picture

Yes! This really helped.

with the patches applied to dev of both image and imagecache everything seems to be functioning great.

grasmash’s picture

Status: Needs work » Needs review

@mcaden: is there also patch that needs to be applied to imagecache for this to work?

UPDATE: yes, I see that I need to also patch imagecache with:
http://drupal.org/files/issues/imagecache.image_integration-20100714.patch

grasmash’s picture

@157 & 158

Ahh.. too bad. I was hoping to do the same thing as bluegray.

Any other way to manually control the crop area via the image module?

UPDATE:

Actually, there is a way to use imagecache presets with the image module without patches. It involves creating a View that manually applies the imagecache preset to the image field (not imagefield). You'll need views customfield.

Create a view and add the relationships "Image:File" and "Image:Node." Then add fields "File:path," "Node->title," and "Customfield: PHP Code." Add this to your php customfield script:

//print var_export($data, TRUE);  //reveals all available variables

$image_src = $data->files_image_filepath;
$imagecache_preset = "Front-Slide-ic"; //enter your own imagecache preset here

$attributes = array('class' => 'lightbox');  //if you want to add attributes
$image_title = $data->node_image_title; 

print theme('imagecache', $imagecache_preset, $image_src, $image_title, $image_title, $attributes);

Using this method allows you to use Image Crop to manually select the crop area.

Anonymous’s picture

Feedback:

Upgraded Image and Imagecache to newest Dev versions

Applied patch in 164 to Image module

Applied patch in 147 to Imagecache module

All working (at present ;) )

joachim’s picture

> Now anyone trying to apply this patch on a live site must visit and save the image presets page at least once. Maybe this can also be done with a hook_update,

@dman: Could you explain what you mean by this?

I've just tried applying the patch to an install of image module *without* admin-defined image sizes (or rather, I deleted the image_sizes variable to simulate this ;) and visited the image admin page and all seems fine.

dman’s picture

non-fatal.
Just that (I think) that if you have an existing site *with* old image settings saved,
and install the update
but don't visit the admin page after updating
and regenerate some images
- there would be php notices about undefined array indexes triggered, and images might not build at all.
because the image derivative generation would be looking for values that aren't there.

mcaden’s picture

> Now anyone trying to apply this patch on a live site must visit and save the image presets page at least once. Maybe this can also be done with a hook_update,

Just verifying I did have to do this on mine. I hadn't made any new presets, but changed the size for the "preview" image preset. When I went to "Image" there was no dropdown box for anything dealing with imagecache. I clicked "save configuration" and on the next page load, the new dropdowns for imagecache presets were there. I didn't see any errors or anything, there simply wasn't anything dealing with imagecache until I had done so.

dman’s picture

When I went to "Image" there was no dropdown box for anything dealing with imagecache.

Slightly different from what I anticipated ... but yeah, there would be a few hiccups like that if installed on a running site. Non-fatal, but could probably be cleaned up somehow

joachim’s picture

Status: Needs review » Needs work

Could someone explain exactly the steps to reproduce the problem? I'm not quite clear on that yet.

mcaden’s picture

Status: Needs review » Needs work

The one I encountered? It was as predicted in one of the posts above.
Here's the steps I followed and what I encountered:

Steps:

  1. Install 'Recommended' Image
  2. Install 'Recommended' Imagecache
  3. Configure Both
  4. Now apply the patches to imagecache and image dev from Comment #162 and Comment #167 above
  5. Upload the patched dev branches of Image and Imagecache, overwriting old installs
  6. Run Update.php

Expected: Imagecache presets would appear as options in the admin page for Image

Actual: No change in the Image Admin

WorkAround:

  1. Go to Image Admin
  2. Click 'Save Configuration' without changing anything
  3. Imagecache presets should now show up as options
joachim’s picture

I'm not seeing that problem at all. Admittedly, this is on my test rig which has been kicking around for a while, but didn't yet have imagecache on it.

Steps I took:

1. downloaded and enabled imagecache.
2. patched all modules
3. created some IC presets
4. went to admin/settings/image. IC presets showed as expected.

There's no need to run update.php btw, as neither patch has update functions.

> The one I encountered? It was as predicted in one of the posts above.

Do you know what causes it?

asb’s picture

@Dan: Have you given up on this issue? What can we do to help?

dman’s picture

I thought it was ready to go at #162.
It works just fine, so I haven't had any need to change it.

A requested nice-to-have is an update hook that, um, ensures all your old image settings are re-saved in the new format. As seen in #172. It used to handle that automatically, but the feature was removed in #162 to try and get it accepted.
If anyone wants to try adding it in, that would be easy I guess.

joachim’s picture

> A requested nice-to-have is an update hook that, um, ensures all your old image settings are re-saved in the new format.

That's not how I understood it... earlier comments seemed to indicate that right now, applying this patch breaks something. That's no good. If some sort of cleanup or conversion is required, it MUST be provided in an update function.

Thing is, I don't understand what breaks and I've not been able to reproduce it. Can anyone explain this clearly please?

mcaden’s picture

Didn't break anything for me. All it involved was the extra step in going in and clicking "save configuration" before anything kicked in as dman has mentioned and as I've confirmed.

dman’s picture

The situation *I* anticipate and can replicate is #171.
And the level of potential broken-ness it : that you get a few php notices - If you have error-reporting turned up to 11 like I do (but non-developers don't) - until such time as you've visited the settings page once.
So I find that 'non-fatal'. Indeed, hard to replicate unless you change your php.ini settings, and send errors to the screen, and go looking for it in that window of time.
I only mentioned it because I normally prefer pure php E_STRICT code, and seeing a notice about an undefined index in my log bugged me. Though that's not the way the bulk of contrib works.
You won't even see this logged notice as an error unless you have configured the site as a development machine

It would be tidier to put a fix for it in an update hook. So whoever thinks that squashing an E_ALL level notice that's visible only to paranoid developers on first-run of an upgrade install is worth it can have a go.

As for the second reported issue (new options not turning up immediately) I can't replicate that either, or anticipate why that could happen once the module is enabled. As it apparently doesn't happen once they refresh the screen (and the module doesn't do any caching) then I don't know. Sometimes you do have to refresh a page to see changes.

Heck, maybe an empty hook_update that just tells you to visit update.php would clear the pipes.

joachim’s picture

> And the level of potential broken-ness it : that you get a few php notices

Could you tell us what the notices actually are please?

> Heck, maybe an empty hook_update that just tells you to visit update.php would clear the pipes.

If it's just a matter of clearing Drupal's cache, then that's to be expected of module upgrades anyway.

dman’s picture

To replicate :

Step #1 - Use a CVS checkout of D6-dev or
HACK CORE to change includes/common.inc:634 from

  if ($errno & (E_ALL ^ E_DEPRECATED ^ E_NOTICE)) {

to

  if ($errno & (E_ALL ^ E_DEPRECATED)) {

Ensure that 'error handling' is set to send messages to the screen.

Step #2
Install & enable current dev image.module, unpatched,
use default sizes or modify them if you want.
Upload an image or two.

Step #3
Install and enable imagecache etc.
Apply patch #163 to image, http://drupal.org/files/issues/231622-image-imagecache_integration-20101...
Apply patch #128 to imagecache http://drupal.org/files/issues/imagecache.image_integration-20100714.patch (now offset, but still working)

Step #4
do not visit update.php.
do not go looking at the image size settings.
Create an imagecache preset of some description

Step #5a pre-used dimension settings do not include all the new settings values?
Upload another image, or edit and 'rebuild_derivatives' on one.
I thought I may get a message saying
<code>notice: Undefined index: scale in .../sites/all/modules/image/image.module on line 934.

At least I thought that was possible - I'm actually unable to replicate it now. I don't know, it just isn't reproducable. It was basically caution, described in #171. There is now no actual problem I can see to fix. It was a maybe thing to look for, seems to be OK.

Step #5b Best way to handle the dimensions flag, still not 100% solved.
Visit the image presets settings, you should be able to select the imagecache option and save.
On the first save, you may see the message
notice: Undefined index: needs_dimensions in .../sites/all/modules/image/image.admin.inc on line 97.

Step #5c Missing dependency if you delete the preset or remove the module
Go to modules and disable imagecache and imageapi.
Revisit an image node or an image edit form.
Warnings like

notice: Undefined index: imagecache-1 in .../sites/all/modules/image/image.module on line 934.
Unable to create scaled Preview image.
The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.

may be displayed, as the tool to generate images is now unavailable.

On the image presets page, you'll similarly see

notice: Undefined index: imagecache-1 in .../sites/all/modules/image/image.admin.inc on line 97.

--------

These sort of warnings were anticipated in #162 when the error-checking code was simplified.
You will not even see these notice level messages unless you have modified your system for development warnings. You have to break your system and go looking for problems before you see these messages that say something is a bit wrong.
This is the only rough edge I know of.

- As for the imagecache preset option not showing up - I still couldn;t replicate that.

joachim’s picture

Thanks for that very comprehensive report :)

I think 5a is obsolete -- nowhere is the index 'scale' actually used as an array key in the patch or indeed the entire module or admin files.

5b is solved by changing the offending line to:

    if (isset($operations[$size['operation']]['needs_dimensions'])) {

This is the D7 way -- doesn't hurt to get used to it now ;)

5c -- it's not just disabling imagecache that will cause this error. You can get it more easily by deleting a preset, and that's something users expect to be able to do without problems.

There's already this code in the imagecache patch:

  // Check the current image.module derivative definitions.
  $sizes = image_get_sizes() ;
  foreach ($sizes as $sizename => $size_def) {
    if (@$size_def['operation'] == 'imagecache-' . $presetid) {
      // Yes, this preset is being used by an image operation.
      drupal_set_message(t("Due do a change in the '%preset' preset, all derived image.module '%sizename' images need updating. This should happen over time as needed.", array('%preset' => $preset['presetname'], '%sizename' => $sizename)));
      // Trigger expiry on (all!) image.module derivatives.
      // This is inefficient, but image.module doesn't let us trigger just one 
      // preset change.
      variable_set('image_updated', time());
      // Once is enough.
      $rebuild_triggered = TRUE;
      return;
    }
  }

This will need changing -- for starters, it introduces a silent dependency with the call to image_get_sizes(). But what I would do instead is invoke a hook_imagecache_preset_changed() in various places so you can tell image module's implementation whether this was a change or a deletion.

(aside:
// This is inefficient, but image.module doesn't let us trigger just one
// preset change.
That's something that could be improved in a follow-up patch -- store times per preset.)

Also, I had another look at the patch...

+++ image.admin.inc	12 Oct 2010 07:51:56 -0000
@@ -110,12 +138,21 @@ function image_admin_settings() {
+    // rebuild (which I cannot force from here).

The convention is first person plural -- use 'we'.

+++ image.module	12 Oct 2010 07:51:57 -0000
@@ -849,24 +921,31 @@ function _image_build_derivatives($node,
     if (!$status) {
       drupal_set_message(t('Unable to create scaled %label image.', array('%label' => $size['label'])), 'error');
-      return FALSE;
+      // One failure may not mean that we should give up entirely. ¶
+      // Make the other derivatives anyway.
     }
     // Set standard file permissions for webserver-generated files
     @chmod($destination, 0664);

This doesn't look right. Yes to not just bailing out. But are those subsequent operations (the chmod, the alter) on the newly generated derivative? If so, those will surely cause problems. I reckon we need a 'continue' here.

Powered by Dreditor.

dman’s picture

5b is solved by changing the offending line to:

    if (isset($operations[$size['operation']]['needs_dimensions'])) {

This is the D7 way -- doesn't hurt to get used to it now ;)

Or, um,

    if (!empty($operations[$size['operation']]['needs_dimensions'])) {

or it'll find FALSE as TRUE.

70% of my drive-by patches to other contribs recently have been inserting isset() or empty() in strategic places like this. I'm strict about STRICT when I can be.

I think you are right about the continue and the image_get_sizes()there.

joachim’s picture

Oh yeah... PHP's empty/isset/is_null always confuses me :/

asb’s picture

@Dan, @joachim: Again this patch seems to vanish into data nirvana. If I was able to follow this issue, there were a couple of success reports (the patches seem to work), and there were some coding style issues (which were fixed?). So how are the chances to get this into a dev release?

From my (naive) point of view as user it is very hard to understand what problems are left. Thus I'd simply like to remind of two facts:

  • Imagecache was already used in the 5.x branch years ago; I can't remember if this was a patch or an unpatched release, but I used it for many months on several sites, and had no Imagecache related issues; in fact I was quite surprised that the Imagecache integration was gone after upgrading to D6;
  • I believe that integrating Imagecache in 6.x should ease the migration to 7.x where Imagecache becomes the standard. If other modules from contrib have issues with derivates created/managed by Imagecache, these problems will surface anyway, be it now on D6 or be it later on D7.

Thank you!

joachim’s picture

The problems left -- at least the ones I found -- are outlined in 184 above :)

shady_gun’s picture

Patch fails on the latest version of Image(6.x-1.1 ) module ...

Courtney.B’s picture

Found bug (maybe?) with Image after patching with #163 and #128. Not sure if I am supposed to post it here though.

Normally with ImageCache, you use Scale to create a preset if you want to resize using one value only. I made the error of selecting Resize instead of Scale. However, unlike what happened prior to patching, where you couldn't even create a Resize preset with a missing value, it allows you to create it and then when adding other presets, throws a bunch of errors at you.

warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/treefest/public_html/dev/sites/all/modules/imageapi/imageapi_gd.module on line 274.
warning: imagealphablending(): supplied argument is not a valid Image resource in /home/treefest/public_html/dev/sites/all/modules/imageapi/imageapi_gd.module on line 291.
warning: imagecolorallocatealpha(): supplied argument is not a valid Image resource in /home/treefest/public_html/dev/sites/all/modules/imageapi/imageapi_gd.module on line 292.
warning: imagefill(): supplied argument is not a valid Image resource in /home/treefest/public_html/dev/sites/all/modules/imageapi/imageapi_gd.module on line 293.
warning: imagealphablending(): supplied argument is not a valid Image resource in /home/treefest/public_html/dev/sites/all/modules/imageapi/imageapi_gd.module on line 294.
warning: imagesavealpha(): supplied argument is not a valid Image resource in /home/treefest/public_html/dev/sites/all/modules/imageapi/imageapi_gd.module on line 295.
warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/treefest/public_html/dev/sites/all/modules/imageapi/imageapi_gd.module on line 157.

Removing the faulty Resize preset has fixed the errors and I can proceed as normal.

Seriously, thank you so much for the patches. It was a life saver!

Courtney.B’s picture

Encountered major problem tonight and had to rollback the patches. I receiving a WSOD for pages that used many images and it was due to imagecache regenerating images when there was already an image available.

msbjhandeer’s picture

Status: Needs work » Needs review
joachim’s picture

Status: Needs review » Needs work

This doesn't need testing, it needs work.

AlfTheCat’s picture

subscribing

fellow’s picture

I use Imagecache 6.x-2.x and Image 6.x-1.1 and want intergration with imagecache presets for image module. Could you please indicate me if there is any patch that works?

asb’s picture

It seems that nobody sees a future for 'Image' module beyond D7. Considering the age, and activity of this discussion, I'd suggest to "won't fix" it.

joachim’s picture

I think it's more that 'Nobody who needs image module to have a future is able or willing to write the code'.

I do wonder what everyone who's using image on D6 is going to do about upgrading to D7 though :/

At any rate, if someone works on this patch, I'll review and eventually commit it.

asb’s picture

I do wonder what everyone who's using image on D6 is going to do about upgrading to D7 though

<cynical>It's currently just 85,266 'Image' module user that won't qualify as early adopters of D7, or won't qualify as D7 adopters at all ;)</cynical>

However, my Chipin proposal still stands (esp. to resolve the Image Attach issue), as there will come a time where my dozend D6 sites with 'Image' module and together half a million of image nodes want to become migrated. But for now, 'Image' module by far isn't the only showstopper.

AlfTheCat’s picture

as there will come a time where my dozend D6 sites with 'Image' module and together half a million of image nodes want to become migrated

Amen to that, but I'm comfortably in a mental state of denial towards that fact right now. I like being sane too much atm. Life is tough enough.

luco’s picture

hey there,

just dropping by to share this link with you folks: http://drupal.org/node/201983#comment-4483072.

hope it helps :] I haven't tested yet, though.

cheers