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:
Posts
Latest
Advice (5)
API (2)
ASP.NET (11)
Blogging (2)
Browsers (5)
Classic ASP (1)
Design (1)
Ecommerce (3)
GDI+ (7)
Handy Stuff (4)
IIS (1)
Misc (8)
Money (8)
Opinion (8)
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
Viewstate
bad developer, bad.
Animation != Application
Frame-based illiteration engulfs world. Developers worldwide cry.
Handy ASP.NET Routines
Bullshit Talks
But money wont shut the hell up.
PostBackUrl Equals Change the Friggin' Form Action
.
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
8/27/2006 3:43:28 AM How about a gradient shadow that looks more realistic? Or a blur effect added to it?