Web Layout
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsWeb DesignWeb Layout

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 1st, 2006, 03:56 PM
hirsch hirsch is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 2 hirsch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 44 sec
Reputation Power: 0
Image keeps getting ASPX extension

Hello All,

Could someone please tell me why my customized flyer will not let me right click the page and save it as a .jpg file? The form works fine and the flyer is displayed in the browser with the added text from the form, but when I try to save the image it saves it as an ASPX file only and even if you change the extension to jpeg it still does not open. Is there a way to fix this, or perhaps incorporate a save button that will let users save the customized flyer as a jpg? Thanks! Here's the code:

<%@ Page Debug="True" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<script language="VB" runat="server">

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

If Page.IsPostBack Then
' load an existing bitmap
Dim oCanvas As Bitmap = CType(Bitmap.FromFile(Server.MapPath("images\closeoutclocks.png")), Bitmap)
Dim encoderParams as System.Drawing.Imaging.EncoderParameters = new System.Drawing.Imaging.EncoderParameters()
Dim g As Graphics = Graphics.FromImage(oCanvas)
g.SmoothingMode = SmoothingMode.HighQuality
g.TextRenderingHint = TextRenderingHint.AntiAlias
Dim oColor As System.Drawing.Color
Dim tColor As String = Request("tColor")
Select Case tColor
Case "black"
oColor = Color.Black
Case "white"
oColor = Color.White
Case "navy"
oColor = Color.Navy
Case "orange"
oColor = Color.Orange
Case Else
oColor = Color.Black
End Select
Dim oBrush As New SolidBrush(oColor)

' render some text
Dim f1 As Font = New Font("Arial",22)
Dim Company As String = Request("TextBox1")
g.DrawString(Company, f1,oBrush ,5,5)

Dim FullName As String = Request("TextBox2")
g.DrawString(FullName,f1,oBrush ,5,35)

Dim Telephone As String = Request("TextBox3")
g.DrawString(Telephone,f1,oBrush ,300,5)

Dim Email As String = Request("TextBox4")
g.DrawString(Email,f1,oBrush ,300,35)

g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQua lityBicubic
g.SmoothingMode = SmoothingMode.HighQuality
Dim quality as long = 100
Dim encoderParam as System.Drawing.Imaging.EncoderParameter = new System.Drawing.Imaging.EncoderParameter(System.Dra wing.Imaging.Encoder.Quality, quality)
encoderParams.Param(0) = encoderParam

Dim arrayICI as ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
Dim jpegICI as ImageCodecInfo
Dim x as integer
for x = 0 to arrayICI.Length-1

if (arrayICI(x).FormatDescription.Equals("JPEG")) then
jpegICI = arrayICI(x)
exit for
end if

next

if not jpegICI is nothing then
oCanvas.Save(Response.OutputStream, jpegICI, encoderParams)
end if
' Now, we only need to send it to the client
Response.ContentType = "image/jpeg"
oCanvas.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.jpeg)


' Cleanup

g.Dispose()
oCanvas.Dispose()
f1.Dispose()
End If
End Sub


</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>E-Flyers</title>
</head>
<body>
<form runat="server">
<div>
Company Name:
<asp:TextBox runat="server" id="TextBox1"></asp:TextBox><br />
Name:
<asp:TextBox runat="server" id="TextBox2"></asp:TextBox><br />
Telephone:
<asp:TextBox runat="server" id="TextBox3"></asp:TextBox><br />
Email:
<asp:TextBox runat="server" id="TextBox4"></asp:TextBox><br />

<asp:dropdownlist runat="server" id="tColor">
<asp:ListItem Value="black">Black</asp:ListItem>
<asp:ListItem Value="white">White</asp:ListItem>
<asp:ListItem Value="navy">Navy</asp:ListItem>
<asp:ListItem Value="orange">Orange</asp:ListItem>
</asp:dropdownlist>
</div>

<asp:Button runat="Server" id="SubmitButton" Text="Generate Image" />

</form>

</body>
</html>

Reply With Quote
Reply

Viewing: ASP Free ForumsWeb DesignWeb Layout > Image keeps getting ASPX extension


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway