Google Answers Logo
View Question
 
Q: Resizing Images using pure ASP ( No Answer,   0 Comments )
Question  
Subject: Resizing Images using pure ASP
Category: Computers > Programming
Asked by: valadares-ga
List Price: $20.00
Posted: 29 Oct 2004 07:39 PDT
Expires: 17 Nov 2004 10:18 PST
Question ID: 421648
I'm programming a website in classic ASP language. I have now a
problem that is: How can I create a solution to upload and resize an
image file (jpg, gif, bmp...), and put it in a especific size? After
that I only want to save the resultant thumbnail in a especific folder
on the server. Important note: I must do it without ASP components
(COM, ActiveX, applets...), but only using pure ASP code.

Request for Question Clarification by tar_heel_v-ga on 29 Oct 2004 07:44 PDT
Will one of these work for you:

http://www.mxmania.net/Applications/resize_script.htm
http://www.visiono.com/products/spirit/applications/photobook/
http://www.chestysoft.com/imagefile/default.asp
http://www.crazybeavers.se/products_imagerresizer.asp

Clarification of Question by valadares-ga on 29 Oct 2004 07:48 PDT
They are all ASP components. Imust do it without ASP components, using
only ASP script. Thank you.

Request for Question Clarification by googleexpert-ga on 29 Oct 2004 07:59 PDT
Hi valadares-ga,
I found a script using ASP.NET code.  Will the following be of use to you?
<%@ 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(request("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.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

 Sub sendError()

 ' if no height, width, src then output "error"
 dim imgOutput as New bitmap(120, 120, pixelformat.format24bpprgb)
 dim g as graphics = graphics.fromimage(imgOutput) ' create a New
graphic object from the above bmp
 g.clear(color.yellow) ' blank the image
 g.drawString("ERROR!", New
font("verdana",14,fontstyle.bold),systembrushes.windowtext, New
pointF(2,2))

 ' 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>



 <%


 ' make sure Nothing has gone to the client
 response.clear


 if request("src")="" or request("height")="" or request("width")="" then

 call sendError()

 else

 if file.exists(server.mappath(request("src"))) then
 call sendFile()
 else
 call sendError()
 end if

 end if


 response.end

 %>

[Source: http://www.plus.hr/skripte/asp.net/resize_image.html]

Thank you.

-googleexpert

Clarification of Question by valadares-ga on 29 Oct 2004 10:03 PDT
Hi ggogleexpert-ga, actually ASP.NET solves the problem much easier
than ASP, but in my case I need the classic ASP script.

Thank you.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy