locked
Script to calculate image size and create thumbnails RRS feed

  • Question

  • User1647631625 posted
    Hi,

    I'm looking for a script that can detect an Images:
    Size (Kb)
    Height
    Width
    Type
    so it can be accepted or rejected when a user tries to upload it to the server.
    and that can then generate thumbnails from the images and save it in a folder on the  server with the origianal images.( i.e not just resize the image, but also reduce it in size (Kb's) and dimensions).

    Anyone knows a script that can do this or can help me do a script like this? Maybe in return for credit.

    Thankx
    Monday, October 31, 2005 12:52 AM

All replies

  • User933648302 posted
    Bitmap img = new Bitmap(@"c:\path\to\your\file.jpg");
    img.Width and img.Height will give you width and height

    you can use FileInfo to get size of the file

    im not sure about type, maybe property items or raw format memeber, check msdn.

    Monday, October 31, 2005 3:34 AM
  • User541108374 posted
    Hi,

    you could check out the file extension of the HttpPostedFile. Use this method: Path.GetExtension Method

    Grz, Kris.
    Monday, October 31, 2005 5:28 AM