Re: Resize images ASP.NET
- From: billmiami2@xxxxxxxxxxxx
- Date: 30 May 2005 03:45:51 -0700
Concerning limiting the file size, there are many threads on this
newsgroup that discuss this topic. Do a search of the group for the
words "upload file size". Methods of handling this include setting a
max request size in web.config and creating an httphandler that
intercepts the request and does some processing to determine if the
file is acceptable.
If you use an httphandler, you can check the
HttpContext.Request.ContentLength in an event handler that handles the
app.PreRequestHandlerExecute event. If the size is greater than a
preset limit, you can then abort the request. However, I don't know
how you would determine if the image dimensions in pixels were above a
preset limit unless you actually stored the image on the server, opened
it and obtained its dimensions. You can do this by saving the image to
a temporary location then opening the image as a System.Drawing.Image
as in
Dim objImage As System.Drawing.Image =
Image.FromFile(Server.MapPath(strImagePath), True)
Now you have access to information about the image by checking values
of properties such as
PhysicalDimension
PixelFormat
Size
Check your documentation on System.Drawing.Image for more information.
Using System.Drawing you can modify the image, place text or graphics
on top of it, combine it with other images, etc. Consult your
documentation for examples on using the various classes within
System.Drawing to create and modify images.
Bill E.
Hollywood, FL
.
- Follow-Ups:
- Re: Resize images ASP.NET
- From: IkBenHet
- Re: Resize images ASP.NET
- References:
- Resize images ASP.NET
- From: IkBenHet
- Resize images ASP.NET
- Prev by Date: Timeout expired
- Next by Date: How to continue request execution in a HttpHandler
- Previous by thread: Resize images ASP.NET
- Next by thread: Re: Resize images ASP.NET
- Index(es):
Relevant Pages
|