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 3rd, 2006, 03:46 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
Run Time Error

Hello all I am still working on this code: I eliminated the errors that I had previously but now I am getting a server run time error. Can anyone tell me why?

Thanks!

<%@ Page Language="VB" Debug="True" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%
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, ImageFormat.Jpeg)

' Cleanup

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="image/jpeg" />

</head>
<body>
<form method="post">

<%
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 > Run Time Error


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 1 hosted by Hostway
Stay green...Green IT