Drop Shadow Effect

Psicomante - August 9, 2008 - 16:17
Project:Imagecache Actions
Version:6.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Description

Is there any way to create drop shadow with this module? I tried with some options but never get it.

imho would be this way

define canvas
3+ watermark for corners
2+ watermark for sides

Anyone has already done it? Thanks.
sorry for my english :(

#1

dman - August 10, 2008 - 04:25

There's no reason why not, although there may be better, dedicated methods to do so.

But we could try with overlays like you say. I'd try a big image that includes the corner and two sides. If you use PNG you can do transparanies. Then two more corners if you want.

... In the long run it would be best to come up with a new action to just do this - so you can define offset, blur and colour. Whoever wants to make that would be cool.

#2

Psicomante - August 15, 2008 - 11:43

i would like to code this action, but i haven't so much time. I add this to the todo list :)

#3

mariuss - August 23, 2008 - 00:54

That would be useful, just tracking this issue.

#4

Djamu - August 26, 2008 - 22:25
Title:Drop Shadow?» Drop Shadow? I did it ..

Drop shadow is easy:

there's 2 ways:
A map based ( that I used )
Several > Define canvas

Prerequisites: > larger then your maximum size transparancy shadow map ( 8 bit alpha ) 32( 24+8 ) bit png is easiest
mine is a 1600x1600 png made in photoshop
top/left have a 1 pixel border
bottom/right a 3 pixel border
The map is overlayed twice to frame the whole picture.
I use a 2 / 4 / 2 / 4 setting on Define Canvas to add an additional 1 pixel white border ( shadow on map is 1/3/1/3 )

my settings ( low to high weight )

Scale And Crop width: 194, height: 194 weight -10
Define Canvas left:2 right:4 top:2 bottom:4 Transparent weight 0
( use the relative size option, this makes the canvas a little bigger to hold the shadow )
( make sure to select the "Resize canvas under image (possibly cropping)" )
Overlay: file image to canvas (watermark) shadow1600x1600.png x:left, y:top alpha:100% weight 1
( underlay would be more appropriate but that doesn't seem to work on my rig )
( this overlays a much larger map starting from left top corner, I'm using the same map for my full size images ... )
Overlay: file image to canvas (watermark) shadow1600x1600.png x:right, y:bottom alpha:100% weight 2
( overlay for the other 2 sides starts @ right bottom )
Change File format Convert to : jpg
( this can be handy to make sure the result gets saved as a -no transparency- jpg )

Alternatively this can be done using several Define Canvas actions:
for example

Scale And Crop width: 194, height: 194 weight -10
Define Canvas left:1 right:1 top:1 bottom:1 RGB:[64, 64, 64] #
Define Canvas left:1 right:1 top:1 bottom:1 RGB:[128, 128, 128] #
Define Canvas left:1 right:1 top:1 bottom:1 RGB:[208, 208, 208] #
Change File format Convert to : jpg

this will add a 3 pixel all-around shadow

or

Scale And Crop width: 194, height: 194 weight -10
Define Canvas left:1 right:1 top:1 bottom:1 RGB:[64, 64, 64] #
Define Canvas left:0 right:1 top:0 bottom:1 RGB:[128, 128, 128] #
Define Canvas left:0 right:1 top:0 bottom:1 RGB:[208, 208, 208] #
Change File format Convert to : jpg

this will create a 1 pixel frame with 2 pixel shadow on the right / bottom side ....

I'm having some issues with ImageMagick, for some reason this only works with the GD2 library.
Imagemagick plays nice with other modules, but not with Imagecache ( Only scale & crop works )...
So if someone can shed some light on this I'll be gratefull...
( Version: ImageMagick 6.3.7 02/19/08 )

the result can be seen on my site > http://3d.uk.to

AttachmentSize
imagecache-preset-200x200.png 24.99 KB

#5

dman - February 12, 2009 - 23:28
Title:Drop Shadow? I did it ..» Drop Shadow Effect
Category:support request» feature request
Status:active» postponed

That approach with borders is not nice enough.
We need an algorithm/process that can give a nice, offset, blurred shade effect.
I won't be building it until I need it myself, but anyone can contribute code. imagcache actions are all modular...

#6

skilip - April 4, 2009 - 13:11

Here's a little module which adds a drop shadow action to imagecache. It's quite simple. Hopefully someone finds the time to add the offset, blurred and opacity configuration options mentioned above.

AttachmentSize
imagecache_dropshadow.zip 9.95 KB

#7

Djamu - April 28, 2009 - 16:06

I wanted to test it,
but it depends on the Array module, which I don't seem to be able to find on Drupal.org

#8

skilip - May 1, 2009 - 07:30

@Djamu

The module I've posted is for D6. Sorry for your inconvenience!

#9

dman - May 2, 2009 - 05:16


This does a job, using just currently available tools.
I'ts not efficient or very configurable however, and makes other effects hard to layer. Something that basic should be done in CSS.

(Overlay - source image to canvas was disabled from DRUPAL-6--1 because I'd forgotten why it was there. It's back now in dev, and should still be there in D5)

#10

maksimk - May 15, 2009 - 14:07
Version:5.x-1.0» 6.x-1.x-dev

Just have used your module but seems there is bug
when width > height then it does not work correct right side is always black

#11

maksimk - May 15, 2009 - 14:25

you have issue
imagefilledrectangle($canvas, 0, 0, $height_canvas, $height_canvas, $background);
need to change it to
imagefilledrectangle($canvas, 0, 0, $width_canvas, $height_canvas, $background);
but it works great thanks !

#12

halver - May 15, 2009 - 15:22

Skilip, you rock. Thanks for the module. Just what I was looking for.

#13

sinasalek - October 12, 2009 - 19:42

subscribed

#14

bkmatwa - October 23, 2009 - 23:43
Category:feature request» support request
Status:postponed» reviewed & tested by the community

Awesome job 'skilip'! Works perfectly in 6.14 and ImageCache 6.x2.0beta 10. Thank you.

 
 

Drupal is a registered trademark of Dries Buytaert.