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?
Leave a Comment
Name:
URL:
Comments:
Posts
Latest
Advice (5)
API (2)
ASP.NET (10)
Blogging (2)
Browsers (5)
Classic ASP (1)
Design (1)
Ecommerce (3)
GDI+ (7)
Handy Stuff (4)
IIS (1)
Misc (7)
Money (8)
Opinion (6)
Side Projects (1)
Swish (12)
VBS (3)
Stores
Books
Software
Video Games
Plasma TVs
LCD TVs
DVD Players
Tivo & DVR
HDTVs
MP3 Players
Camcorders
Cameras
Cell Phones
Desktops
Laptops
USB Flash Drives
Hard Drives
LATEST POSTS
PostBackUrl Equals Change the Friggin' Form Action
.
Curse you DBNull and/or Is Nothing!
.
Career Developers are Shitbags
they are.
Consolas Makes Me Geek-ier
MS Consolas Font Abuse
Things I Read Today and You Should Too
Whilst searching for solutions I happened upon...
ADS
MOST POPULAR
Multiple IEs in Windows
Date Image Thing
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
8/27/2006 3:43:28 AM How about a gradient shadow that looks more realistic? Or a blur effect added to it?