SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Save image on disk

    What should I change in following script to save the resized image on my disk? Currently display the image in browser.

    <% ' import all relevant namespaces %>
    <%@ import namespace="System" %>
    <%@ import namespace="System.Drawing" %>
    <%@ import namespace="System.Drawing.Imaging" %>
    <%@ import namespace="System.IO" %>

    <script runat="server">

    Sub Page_Load()

    ' create New image and bitmap objects. Load the image file and put into a resized bitmap.
    dim g as System.Drawing.Image = System.Drawing.Image.FromFile(server.mappath("2008.jpg"))
    dim thisFormat=g.rawformat
    dim imgOutput as New Bitmap(g, 58, 79)

    'Set the contenttype
    if thisformat.equals(system.drawing.imaging.imageformat.Gif) then
    response.contenttype="image/gif"
    else
    response.contenttype="image/jpeg"
    end if

    'send the resized image to the viewer
    imgOutput.save(response.outputstream, thisformat) ' output to the user

    'tidy up
    g.dispose()
    imgOutput.dispose()

    end sub
    </script>

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .net thumbnail

    what do you want to do exactly itHighway? Do you want to make a thumbnail out of an uploaded file, or what?

  3. #3
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The image name is "2008.jpg", I want to:

    1- Resize it to 58 x 79 px
    2- After resizing system should automatically save this image to my disk with name "2008-resized.jpg"

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Sep 2002
    Location
    Cleveland, Ohio, USA
    Posts
    1,494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Come on man... image resizing in .NET has been well documented. Google.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •