Transparent Rounded Corners for imagecache_actions.

Carlitus - October 12, 2008 - 09:56
Project:Imagecache Actions
Version:5.x-2.3
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

I think a great action could be the rounded corners. ¿do you have in mind to do this?

#1

dman - October 12, 2008 - 12:18

You can get a similar effect by placing some corner overlays in each corner using watermark. Try that.

I'm thinking of doing a 'mask' filter, which could include rounded corner effects, but currently I don't have a site for which this is useful. So I won't be doing it soon.

#2

dman - October 12, 2008 - 12:20
Status:active» postponed

So ... not now, but if someone's got code to contribute we can try it.

#3

zmove - November 25, 2008 - 15:47

Watermark can be a solution for images that always have the same background. Else, you always have some cache color problem with png8 or transparency problem on ie6 with png24...

so, subscribe

#4

flobruit - December 4, 2008 - 07:38

A more generic idea would be to have a "corner overlay".

The idea is similar to the technique where you have one overlay for each corner, but you would only specify one image that is used for the top left corner, and the same image would then be flipped vertically and/or horizontally for the other corners.

#5

ngreenup - December 10, 2008 - 21:25

In my opinion having the ability to have rounded corners is essential. I am not really having much luck getting rounded corners with this module or rounded corners module(it does work well on certain content but not my thumbnails that launch thickbox).

In a perfect world I would have the ability to give the image rounded corners that would work on any background, not just a solid color. You could also add a drop shadow and launch thickbox :)

How much time is involved in making this mask filter?

Would it be something you would consider writing asap if you had a sponsor?

#6

dman - December 11, 2008 - 01:15
Status:postponed» active

That's the spirit! I need some xmas pocket-money.

I've scoped it out and know it can be done well and properly - either full png transparency or solid fill.
Incorporating a proper 'mask' effect that can be re-used in the pipeline. Maybe.

The algorithm may not be the fastest - there's nothing in gd for 'masking' that I can see so it's pixel-by-pixel. But it's cached after all.
so-
For DRUPAL-6, GD, PHP5 only, (no imagemagick) with testing and tweaks.
No borders or dropshadows (yet), just a radius
But it can certainly have full anti-alias smoothing (something all other examples I've seen fail to do)

If one or more folk can raise $200US on paypal I'll post it up within 24 hrs.

Sound fair?

I can't embed a ChipIn widget here, but anyone should be able to help us out at this ChipIn page. First few $ will go back to the Drupal Association!

#7

dman - December 11, 2008 - 01:20
Title:Rounded corners» Transparent Rounded Corners for imagecache_actions. Help raise a quick bounty before Xmas.

Explicit title for the tracker eyeballs.

#8

dman - January 5, 2009 - 20:34

Well THAT got an enthusiastic response :-}
Anyway - thinking about it was half the battle, and I had a go at it in dev anyway. I got it to a point where it works for me but haven't had the need to test it in edge cases. If you want to play with the DRUPAL-6-DEV or CVS release, you may find it does what you want.

It uses slightly odd - but antialiased (!) - masking to get the job done. Possibly not efficiently, but effectively.
As it uses true transparency, you MUST flatten jpegs onto a solid background as a separate process - it's documented.

#9

dman - February 12, 2009 - 23:24
Status:active» fixed

in 6--1-2

#10

System Message - February 26, 2009 - 23:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#11

tobiasr - March 15, 2009 - 08:58
Status:closed» active

Offering $100 Paypal for a 5.x backport of this.

#12

dman - March 15, 2009 - 09:26

Can be done. GD toolkit (not imagemagick) only though.
I've be rolling this option into D6 soon, so I'll see about a D5 backport while I'm at it.
Genuine Support like this is much appreciated :-B

#13

dman - March 16, 2009 - 01:55
Status:active» needs review

OK, Try this (also available soon as a Drupal-5-dev branch). Bundled for your convenience, although the patch is pretty basic also.

If this suits your purpose, I can use a paypal [dan@coders.co.nz] input to renew my Drupal Org membership, and will do the same on behalf of canaryMason who recently contributed updates to some of the code I just backported.

Please give it a go!

AttachmentSize
imagecache_actions.tar_.gz 562.03 KB

#14

dman - March 18, 2009 - 00:09

tobiasr ?
What to you think? Fits your needs? Save you some time?

#15

dman - March 25, 2009 - 21:59

??? ping?
It's done. Testing testing?

#16

dman - April 8, 2009 - 08:55
Status:needs review» fixed

So much for that bounty?
:-(

#17

tobiasr - April 13, 2009 - 10:38

Sorry! I didn't get notifications to this issue.

I tried it and it doesn't seem to work for me. When I set Rounded Corners as only action, it generates the image, but the corners are not rounded.

#18

levavie - April 21, 2009 - 09:16
Status:fixed» needs work

Thanks, it works great on my D5 installation! But only for PNGs.

For JPEGs, the rounded corners did't save for JPEGs - I tried the extra steps recommended in your 'add filter' screen but it did't do any change. I feel that the extra steps needed for JPEG need to be done automatically, in the background.

Alternatively, please add an action for Image format conversion

#19

levavie - April 21, 2009 - 10:57

It seems that the imagecache_coloractions.module included in the Drupal 5.x package was not updated to the new imagecache actions API (imagecache.module 5.x-2.0), like imagecache_canvasactions.module, so that the color actions mentioned on the roundedcorners helptext are no longer available.

#20

levavie - April 21, 2009 - 11:00

Meaning imagecache_canvasactions.module WAS updated by the great abovementioned patch, but imagecache_coloractions.module wasn't, so it's only available for PNGs.

#21

dman - April 21, 2009 - 12:24

Imagecache coloractions has included the format converter forever. It didn't get backported because it was in imagecache_coloractions 5 already.

It could be that the preset is not showing up due to weird preset caching done by imagecache.
If you enable the various action modules one by one, sometimes some are not recognised.
I don't know how to fix that, as the caching changed a lot between various (sub) versions of imageapi. trying to clear the cache one way led to errors the next month as the API changed.

It all depends on exactly which versions of imageapi and imagecache you choose.

There appear to be issues again with imagecache.
This patch was built against imagecache DRUPAL-5.x-1.4
More recent dev versions may have changed the API again. I didn't expect that to happen to the DRUPAL-5 stable branch.Not without a version number change.

#22

levavie - April 22, 2009 - 16:03

It's strange. The moment I uninstall the 'imagecache canvasactions' module, the 'change file format' filter is visible but I don't see the 'rounded corners' action. When I reinstall 'imagecache canvasactions' the 'rounded corners' action becomes visible but the 'change file format' action disappears again.

I've noticed there is no ".install" file for coloractions - is that related?

Did you spell the correct version#? imagecache-5.x-1.4 is more then a year old. I'm using imagecache-5.x-2.4. Or did you mean imagecache-actions-5.x-1.4 ? (your version is a complete replacement, not a patch, so it shouldn't matter).

#23

dman - April 22, 2009 - 23:29
Title:Transparent Rounded Corners for imagecache_actions. Help raise a quick bounty before Xmas.» Transparent Rounded Corners for imagecache_actions.

I can only say for sure what version of imagecache this was built against at the time. Somewhere between 5.x-1.4 and 5.x-2.4 things changed and broke everything. Unfortunately it was not at the 1 >2 step, which would have made sense.
It was Image API version 6-1.4 or, um ... 5-1.5. That's imageAPI - not sure about imagecache. It was supposed to be an API, so that's the key factor.

Aarg!

Yes, the lack of .install file is somewhat related, in that it was the install process that at some point had to start manually flushing a cache so that new actions could be recognised.
I tried adding one in the CVS-DRUPAL-5-dev but it didn't seem worth a new release as it only affects folk who install coloractions and no other effects. Which is rare.
There is basically zero benefit in the internal caching of available actions that imagecache does, so it's just been a pain.

However, I can't imagine what would make an existing action disappear. I used to have a hell of a time making them go away even after removing the module.
With canvasactions you get:

Define Canvas
-Define the size of the working canvas and background color, this controls the dimensions of the output image..
Overlay: source image to canvas
-Places the source image onto the canvas for compositing.
Overlay: file image to canvas (watermark)
-Choose the file image you wish to use as an overlay, and position it in a layer on top of the canvas.
Underlay: place a file image under the current image (background)
-Choose the file image you wish to use as an background, and position the processed image on it.
Rounded Corners (individually configurable)
-This is true cropping, not overlays, so the result can be transparent.

With coloractions you get:
Color Shift
- Adjust image colors.
Brightness
- Adjust image brightness.
Negative Image
- Invert colors and brightness.
Change File format
- Choose to save the image as a different filetype.
Alpha Transparency
- Adjust transparency.

I can't imagine why they would be turning off.

Now, it's true that file format doesn't really belong in color actions, but it was first built only because it was required to support the alpha transparency (color) effect. And It doesn't belong in canvasactions any more than the other.
And I don't want to make a library just for that one thing unless there are other utilities worth doing. But what? Like EXIF insertion :-}

I don't know why, but the 5.x-2-dev snapshot is refusing to show up on d.o. Although it's been marked as enabled for ages.

#24

dman - April 23, 2009 - 00:56
Version:5.x-2.0» 5.x-2.3

This is giving me too many headaches to track
I made a new branch imagecache_actions-5--3 that is compatible with ... well, whatever the recent changed version of imageapi is, and incompatible with earlier imageapi, whichever number that is.
http://drupal.org/node/442280
Get it from CVS or wait for the roll

 
 

Drupal is a registered trademark of Dries Buytaert.