| Project: | Image Assist |
| Version: | 4.7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi, I sort of rolled together http://drupal.org/node/59209 and http://drupal.org/node/70099 into a single patch. Besides adding the "none" alignment I also add a "center" alignment. I think it's not quite perfect but it's a good first stab. Besides the attached patch you will need to add the following rule to wherever you keep your style sheet:
span.center {
margin: 0 auto;
display: block;
}Span's not a block level element unless you make it one, so it can't have a specified size, so you can't center it with automatic margins. Hence, we make it a block, and give it automatic left and right margins. This is not a floating block so content after it does not have to clear it.
I rolled these patches together because centering alignment involves working with the image size.
I decided to move the addition of the original size inside the check that the program uses to determine if you're allowed to use arbitrary sizes. This should ideally be a separate option but I haven't gotten there yet (and may not, since it doesn't really apply here.)
| Attachment | Size |
|---|---|
| img_assist-alignment-and-origsize.patch | 2.74 KB |
Comments
#1
I changed my mind and added a permission called 'use original size', and moved the code to insert the original size option so that it now requires this permission. (I think as it's written you might have to have "Access advanced options" as well, not sure. Not sure if this is desirable or not, either.) This is the only change between the patches, so whichever behavior the community would like is available and fine with me :)
#2
Patch updated for CVS version (cvs, 23/10/2006 - 22:46)... somewhere along the line apparently something changed because the original size option used to work, and now it doesn't. Now, it works again. I'm now using only API calls to get the information; these calls use the installed image toolkit, whee.
This patch rolls together the original size and alignment patches (both "none" and "center") into a single patch.
#3
Patch updated for CVS version (cvs, 23/10/2006 - 22:46)... somewhere along the line apparently something changed because the original size option used to work, and now it doesn't. Now, it works again. I'm now using only API calls to get the information; these calls use the installed image toolkit, whee.
This patch rolls together the original size and alignment patches (both "none" and "center") into a single patch.
#4
Changing version to cvs, and I eliminated a needless variable so I'm resubmitting.
#5
@drinkypoo could you submit a unified diff patch described under http://drupal.org/diffandpatch? I'll take a look once that is up. Thanks.
#6
Here 'tis. I ended up patching the .css file in the bargain, might as well. (so this is a recursive unified diff, whee.)
#7
I find the centering does not work.
However. if instead of
+ if ( $attributes['align'] == "center" ) {+ $output = "<span class=\"inline {$attributes['align']}\" style=\"width: {$attributes['width']}px;\">";
+ } else {
+ $output = "<span class=\"inline {$attributes['align']}\">";
+ }
You leave that bit the way it was, and add "text-align:center" to the span.center class, plus
change
$output .= "<span class=\"caption\" style=\"width: {$width}px;\">$caption</span>";
to
if($attributes['align']=='center'){
$output .= "<span class=\"caption\">$caption</span>";
}else{
$output .= "<span class=\"caption\" style=\"width: {$width}px;\">$caption</span>";
}
everything works.
#8
text-align: center;is not supposed to center anything but text. It was originally implemented to behave this way in IE (official suicide bomber of the ACID2 test) because CSS centering is hard. If Moz does it now it's only to try to achieve parity with IE, but it's still not compliant CSS.It works properly here; maybe we just need a different name for the style to avoid a collision? Is there a standard drupal style for centering? I'll set up a new test site and test out the patch on a plain vanilla install to see if it works there.
#9
I would appreciate a patch for the latest 4.7 version. Marked 70099 and 60771 as duplicates of this issue.
#10
Here is the patch for img_assist-4.7.x-1.x-dev.tar.gz, which I retrieved about five minutes ago.
#11
Fixed in CVS commit 46560.
#12
Thank you! You might amend your cvs message to note that it's also alignment options (provides none and center.)
#13
Sorry, I don't know how to amend a CVS message.
#14