Quick Dropshadow
The Code: shadow.aspx
<%@ Page Explicit="True" Language="VB" Debug="True" %> <%@ Import Namespace="system.drawing" %> <%@ Import Namespace="system.drawing.imaging" %> <%@ Import Namespace="system.drawing.drawing2d" %> <%@ Import Namespace="system.io" %> <script runat="server"> dim Filename as String dim Width, Height, shadowSize as Integer dim Bitmap as system.drawing.bitmap dim Graphix as Graphics dim ImgFormat as ImageFormat dim Img as System.Drawing.Image Dim baseMap as Bitmap dim top, left as Integer sub CreateGraphic() Filename = Request.QueryString("filename") Filename = server.mappath(Filename) ImgFormat = ImageFormat.jpeg : response.contenttype="image/jpeg" Img = system.drawing.image.FromFile(Filename) Width = Img.Width Height = Img.Height shadowSize = 10 baseMap = new Bitmap(Width+shadowSize,Height+shadowSize) Dim myGraphic as Graphics = Graphics.FromImage(baseMap) with myGraphic .FillRectangle(new SolidBrush(Color.white), 0, 0, Width+shadowSize, Height+shadowSize) .FillRectangle(new SolidBrush(Color.darkgray), 10, 10, Width+shadowSize, Height+shadowSize) .FillRectangle(new SolidBrush(Color.black), 0, 0, Width+6, Height+6) .DrawImage(Img, 2,2, Width+2,Height+2) end with Img.dispose() end sub </script> <% CreateGraphic baseMap.Save(Response.OutputStream, ImageFormat.JPEG) baseMap.dispose() Img = Nothing response.end %>
Usage
<img src="shadow.aspx?filename=FILENAME.JPG" />
Example
Comments
Nerdful
8/27/2006 3:43:28 AM
How about a gradient shadow that looks more realistic? Or a blur effect added to it?
Comments Disabled For Now
Name:
URL:
Comments:
Chicago Web Design
Posts
Latest
Advice (5)
API (2)
ASP.NET (12)
Blogging (2)
Browsers (5)
Classic ASP (1)
Design (1)
Ecommerce (3)
GDI+ (7)
Handy Stuff (5)
IIS (1)
Misc (8)
Money (8)
Opinion (8)
Side Projects (2)
Swish (12)
VBS (3)
LATEST POSTS
Long Overdue Update
Reading Various Files into Datatable
Some quick ways to access common data files
More Handy .NET
Dont say I never gave you anything.
Viewstate
bad developer, bad.
Animation != Application
Frame-based illiteration engulfs world. Developers worldwide cry.
ADS
MOST POPULAR
Multiple IEs in Windows
Firefox Vs. The World
Who Is Xperya?
ActionScript Form Fields
Quick Watermark
IE 7 beta 2 standalone
IP Address Tool
Chicago Web Design
Free Text Messaging
Dual Monitor Wallpapers
Tattoo Fonts
8/27/2006 3:43:28 AM How about a gradient shadow that looks more realistic? Or a blur effect added to it?