473,385 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Saving resized Images

Hi!
I found out how to manipulate (read,resize, etc..) images using
System.Drawin namespace from this site:
http://authors.aspalliance.com/chris...asp?category=9
But i don't know how to save resize image on hard disc. So i hope someon
could help me.
The biggest problem is that i run win98 system so no .Net framework testing
is possible.

If someone could give me a hint on how to change this asp code to actualy
save resized image on disk, it would be great!

'INCLUDES
<%@ Page Language="vb" Debug="True" %>
<%@ import namespace="System" %>
<%@ import namespace="System.Drawing" %>
<%@ import namespace="System.Drawing.Imaging" %>
<%@ import namespace="System.IO" %>

<script runat="server">

Sub sendFile()

' 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(reque st("src")))
dim thisFormat = g.rawformat
dim imgOutput as New Bitmap(g, cint(request("width")),
cint(request("height")))

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

'******************************************
'* HERE i need something (some class or function)
'* that will be placed instead of Response.OutputStream
'* ..something like a file object or something. if anyone knows
'* what to put here it would be great
''*********************************************

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

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

end sub

' Set the contenttype
response.contenttype="image/gif"

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

' tidy up
g.dispose()
imgOutput.dispose()
end sub
</script>

Nov 18 '05 #1
1 2549
Try something like this
yoursystemdrawingimage.save("rootpathfilename",Ima geFormat.Jpeg)
you might need to replace the ImageFormat.Jpeg to another format for your
particular image.

"toma" <NO*************@Mhi.hinet.hr> wrote in message
news:bp**********@bagan.srce.hr...
Hi!
I found out how to manipulate (read,resize, etc..) images using
System.Drawin namespace from this site:
http://authors.aspalliance.com/chris...asp?category=9
But i don't know how to save resize image on hard disc. So i hope someon
could help me.
The biggest problem is that i run win98 system so no .Net framework testing is possible.

If someone could give me a hint on how to change this asp code to actualy
save resized image on disk, it would be great!

'INCLUDES
<%@ Page Language="vb" Debug="True" %>
<%@ import namespace="System" %>
<%@ import namespace="System.Drawing" %>
<%@ import namespace="System.Drawing.Imaging" %>
<%@ import namespace="System.IO" %>

<script runat="server">

Sub sendFile()

' 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(reque st("src")))
dim thisFormat = g.rawformat
dim imgOutput as New Bitmap(g, cint(request("width")),
cint(request("height")))

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

'******************************************
'* HERE i need something (some class or function)
'* that will be placed instead of Response.OutputStream
'* ..something like a file object or something. if anyone knows
'* what to put here it would be great
''*********************************************

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

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

end sub

' Set the contenttype
response.contenttype="image/gif"

' send the resized image to the viewer
imgOutput.save(response.outputstream, imageformat.gif) ' output to the user
' tidy up
g.dispose()
imgOutput.dispose()
end sub
</script>

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dag Eilertsen | last post by:
The script below resizes images into two different sizes. My problem is that the quality of the resized images is poor. Any idea how to improve my script? The users are only uploading jpg's. ...
1
by: adolph | last post by:
Using Access2000, I would like to resize an image then save it to a new file with the resized size. I'm taking pictures (JPGs) with my digitial set at 3.2 megs. I've figured out how to get my...
0
by: E | last post by:
I wrote code which Resizes images and then saves them below is the 2 methods. The problem is that half of the resized image turns out gray, as if it wasn't completed. Could someone please tell me...
0
by: E | last post by:
I wrote code which Resizes images and then saves them below is the 2 methods. The problem is that half of the resized image turns out gray, as if it wasn't completed. Could someone please tell me...
4
by: funcSter | last post by:
Hey, got a prob which is driving me nuts! I'm trying to resize the resolution of an image as well as it's pyhsical byte size. I've got: byte bytImage = null; System.Drawing.Image imgImage =...
6
by: Neo Geshel | last post by:
Greetings. I am making an admin interface, which allows me to upload photos to an access DB. The admin interface also needs to display the uploaded photos, but only needs to show them at a...
12
by: tjonsek | last post by:
I get a generic error (not very helpful) when attempting to save a re-sized image back to its original location. Here is the code snippet: Dim g As System.Drawing.Image =...
4
by: Anna97 | last post by:
Hi, I guess I've built my site sort of strangely: The images are in the html (using tables), but the text is all in css positioned using coordinates (hovering over the images). I need my page...
3
by: pozze | last post by:
Hi, I've just made the change from ASP to .net. I have a file (code below) that saves a user submitted file to a MS SQL 2005 database. It collects the file name, file size, file type, and lastly...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.