Hi,
The class name for custom sized images in the 5.x-2.x version of img_assist has changed from just "image-img_assist_custom" to image-img_assist_custom-WWxHH where WW is the custom width and HH is the custom height. This makes it very difficult for lightbox2, other modules and themes to (a) theme the image assist images and (b) find them using javascript.
Would it be possible to re-instate the old class name convention or at least add another class name to the list, e.g. image-img_assist_custom image-img_assist_custom-WWxHH ?
Cheers,
Stella
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 303945_custom_size_class.patch | 610 bytes | fenstrat |
| #13 | img_assist-HEAD.custom-size-class.patch | 799 bytes | sun |
| #11 | img_assist-001-remove-width-height-from-class.patch | 476 bytes | hapydoyzer |
| #7 | img_assist-001-remove-width-height-from-class.patch | 476 bytes | hapydoyzer |
Comments
Comment #1
sunWe probably overlooked the fact that the filename is used as class name when this (trivial) feature was implemented. Of course, Image Assist should always use a default class name. I am even not able to imagine a use-case for a separate "custom" class, so we might drop that completely? Is there a use-case for those different image size preset classes at all?
Comment #2
stella commentedAs long as there's a image assist specific class name, then lightbox2 is happy (or will be after a few adjustments). Lightbox2 also looks at the filename and removes the classname from it to get the original sized image, but i can figure that bit out.
Cheers,
Stella
Comment #3
sunHm - while we're at it, we could improve that, too. Do you have an idea how we could include information about the target size filename?
Unfortunately, I cannot find a related issue currently, which was a feature request to allow configuring the image size for images in the popup window. However, accounting for that idea, we'd have to pass on the file that should be used in the popup window, resp. Lightbox.
How about a (XHTML-Strict breaking) custom attribute? Abusing another attribute? Injecting the filepath as additional class name? Or just replacing/adjusting the href attribute of the link?
Comment #4
stella commentedWhat's the status of this? Lightbox2 doesn't need the filename to be modified, just as long as there's an image assist specific class name.
Comment #5
stella commentedbump
Comment #6
twodI'd have to vote no to an XHTML-Strict-breaking attribute. Many developers try very hard to keep things Strict, and some browsers are very fond of breaking things if they aren't given what's promised by the DOCTYPE.
Maybe a class like "img-filename-My-Quirky-Fil3_name.JpG" would not be optimal, but I'd say it's the best shot.
Comment #7
hapydoyzer commentedThis patch simply removes height and width information from class.
Comment #8
hapydoyzer commentedThis patch simply removes height and width information from class.Comment #9
hapydoyzer commentedSorry :)
Comment #10
twodThe patch-link in #7 leads to http://drupal.org/files/issues/. :(
Comment #11
hapydoyzer commentedVery strange... Reuploading.
Comment #12
Golem07 commentedI have applied this patch to the latest (3.x) dev version of image assist. Since this small line of code is identical I hoped there is no big deal.
I actually does trigger lightbox now. Was so happy that it "worked" finally. Sadly just to find out that lightbox cannot find any image now and displays the dummy only as soon as I use a custom size :(
Is there a solution to this?
Many thanks in advance!
Comment #13
sunUhm, that patch was horribly wrong - it limits you to create only 1 custom size.
Please test attached patch.
Comment #14
Golem07 commentedThanks a lot for the quick response.
I have applied the patch. But lightbox is still not being triggered. Checking the image with Firebug it seems to still have the dimensions in the class name.
Comment #15
hapydoyzer commentedPatch in #13 not working for me.
Comment #16
sunPlease make sure you flushed your *filter* cache. Image Assist provides a link at the top of its configuration settings page to do so.
Comment #17
hapydoyzer commented@sun, your patch modify $attributes array, but it is not returned outside of the function...
Comment #18
tomsm commentedsubscribing
Comment #19
NukeHavoc commentedThis remains an issue in the latest Image Assist 5.x beta, with an added twist: where as Image Assist previously used pre-defined classes for "thumbnail", "preview", etc., it's now using custom sizes for everything. This wouldn't be a huge deal except for the fact that there is no consistent custom class name for the images that I can style (as previously noted, it's including the height/width information in the class name).
As a solution, couldn't there simply be an additional "img_assist_custom" class (above and beyond the standard "image-img_assist_custom-125x176" class) ? Would this confuse Lightbox? (I'm not using it, so I'm not sure what's needed for its integration to work properly).
As was mentioned elsewhere in the thread, is there a reason why the height/width information is being included in the class? Are people dynamically generating CSS to apply to these classes, or is there some other use I'm not seeing?
Comment #20
Robbert commentedYou forgot to pass $attributes to image_display. Thus the last line of your patch should be return image_display($node, $label, $attributes);
Comment #21
fenstratHere's an update to sun's patch from #13. Only change as per #17 and #20 is that $attributes is now added to the image_display() call.
Comment #22
agogo commentedTired of update patches that doesnt work and confusion because of all different versions of the same module?
I just did this to my img_assist.module, line 1497 (6.x-2.0-alpha4):
Changed:
$size['key'] = 'img_assist_custom-' . $width . 'x' . $height;Into:
$size['key'] = 'img_assist_custom';...and then I flushed all caches. Voila!
Problem solved.
Comment #23
stella commentedThis patch works great for me with latest 3.x dev branch. Any chance of getting this committed?
Comment #24
fenstratConfirmed, the patch in #21 still fixes this issue.
For those using lightbox2 there was a work around recently committed in #303780: Image Hander fails on custom image presets
Comment #25
sunThanks for reporting, reviewing, and testing! Committed to 3.x.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.