Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If there is a float value in the style on the image, it is ignored when using the "If resized, add a link to the original image" option. Since the float style is on the image inside of the a tag, and the a tag is (typically) inline and not floated, the image is displayed inline.
Since the height and width are parsed from the img tag for resizing, I would like to also parse the float value from the style attribute, and apply that to the link tag that's added in.
Comment | File | Size | Author |
---|---|---|---|
#3 | image_resize_filter-2163485-3.patch | 1.8 KB | BrockBoland |
#2 | image_resize_filter-2163485-1.patch | 1.25 KB | BrockBoland |
Comments
Comment #1
BrockBoland CreditAttribution: BrockBoland commentedThe attached patch will look for a
float
in the style on the image, or analign
attribute, and if found, add it as a float on the link that's wrapped around the image.This needs:
And one important caveat:
style
attribute (which includes the float) will be stripped from the link tag. There's really not a good way around this.The caveat might negate any desire for an enable/disable checkbox: it won't work as most users will expect, so it's probably only useful in cases where users will not be restricted to Filtered HTML.
Comment #2
BrockBoland CreditAttribution: BrockBoland commentedAnd, of course, the patch file.
Comment #3
BrockBoland CreditAttribution: BrockBoland commentedSlight change from my last patch. As I mentioned in that comment, the important caveat was that the style attribute—and the float value in it—is stripped when using the standard Filtered HTML text format. The change here is to add a class to the link (
floatleft
orfloatright
) so that these classes can be defined in the site CSS.