Re: Resize images ASP.NET

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

.



Relevant Pages

  • Re: A-B PLCs ?
    ... For instance, each data frame, according to the documentation ... doing packet captures while using GetDataLog.exe & ... In the captured data, the packets always were the same last 4 ... Every time you request, the first request packet ...
    (microsoft.public.vb.general.discussion)
  • Re: case study: want to print redirects when LWP::UserAgent makes a request
    ... HTTP::Request object, how I can use the user-agent to request the ... request object and print out a list of HTTP redirects that it ... the documentation. ...
    (comp.lang.perl.misc)
  • Re: giving users their own http logs
    ... The directives used and their purpose is explained in the Apache ... documentation, so I won't go deeply into it, but just see the specific ... The SetEnvIf documentation reads: ... request", so the request method is included, as well as the querystring, ...
    (RedHat)
  • Re: DCL enhancement - REQUEST/REPLY - how to capture a value.
    ... >> serve up the response via a DCL symbol, ... >> system service documentation for details. ... > define verb REQUEST ... I don't have access to the SLS images here at ...
    (comp.os.vms)
  • Re: [PATCH] check_/request_region fixes & request for enlightenment
    ... You pass the same address and size you used to request the region. ... chip, so, I am not quite sure if it is safe here to just blindly configure ... > I've been digging for a while looking for some documentation on this, ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)