%
Class clsLarry2
Private rSessionUID '1
Private rMessage '2
Private rClipArtFile '3
' Private rClipArtFile2 '3
Private mActionFileName '4
Private mClipArtFolder '5
Private mClsFolder
Private mCustomize
' Private mMaxSections '6
Private mMaxTextLines '7
Private mWidthMaxMM '8
Private mHeightMaxMM '9
Private mMaxFontSize '10
' Private mStampShape '11
Private mProductID '12
Private mBackGroundName
Private mTextColorName
' Private mBlockWidth
' Private mBlockHeight
' Private mBlockContent
Private Conn
' Private ImagePercent
' Private ImagePercent2
Private Sub Class_Initialize()
Dim arr,clsCN,clsRS,clsSQL
arr=Array(12)
rSessionUID=CStr(Session.SessionID)
rMessage=""
mActionFileName=""
mClipArtFolder="stamps/images/nameplateimage/"
' mClsFolder="nameplates/"
mMaxTextLines=6
Conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("database/L5XL7L1D.mdb")
If not IsEmpty(Session.Contents(rSessionUID)) then
arr=Session.Contents(rSessionUID)
rSessionUID=arr(1)
rMessage=arr(2)
rClipArtFile=arr(3)
mActionFileName=arr(4)
' mClipArtFolder=arr(5)
mClsFolder=arr(6)
' rClipArtFile2=arr(7)
mProductID = arr(12)
else 'Initialize New Session
if Request.QueryString("ProductCode")<>"" then
mProductID=Request.QueryString("ProductCode")
ElseIf Session("tequilamProductID")<>"" then
mProductID=Session("tequilamProductID")
Elseif Request.Form("mProductID")<>"" then
mProductID=Request.Form("mProductID")
End if
End if
on error resume next
Set clsCN = Server.CreateObject("ADODB.Connection")
clsCN.Open Conn
IF Err.Number<>0 then
Conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("../database/L5XL7L1D.mdb")
clsCN.Open Conn
end if
clsSQL = "SELECT * FROM Products WHERE ProductCode='"& mProductID &"'"
Set clsRS = Server.CreateObject("ADODB.Recordset")
clsRS.Open clsSQL,clsCN,0,1
If Not clsRS.EOF then
mMaxSections = clsRS.Fields("MaxSections")
' mMaxTextLines = clsRS.Fields("MaxTextLines")
' mWidthMaxMM = CDbl(clsRS.Fields("WidthInches")) *25.4'clsRS.Fields("WidthMaxMM")
' mHeightMaxMM = CDbl(clsRS.Fields("HeightInches")) *25.4'clsRS.Fields("HeightMaxMM")
' mMaxFontSize = clsRS.Fields("MaxFontSize")
' mStampShape = clsRS.Fields("StampShape")
' mBlockWidth = clsRS.Fields("BlockWidth")
' mBlockHeight = clsRS.Fields("BlockHeight")
' mBlockContent = clsRS.Fields("BlockContent")
mBackGroundName = clsRS.Fields("BackGroundName")
mTextColorName = clsRS.Fields("TextColorName")
mCustomize = clsRS.Fields("Customize")
End if
clsRS.Close
clsCN.Close
Set clsRS = Nothing
Set clsCN = Nothing
End Sub
Private Sub Class_Terminate()
Dim arr
arr=Array(12)
arr(1) = rSessionUID
arr(2) = rMessage
arr(3) = rClipArtFile
arr(4) = mActionFileName
' arr(5) = mClipArtFolder
arr(6) = mClsFolder
' arr(7) = rClipArtFile2
arr(12)= mProductID
Session.Contents(rSessionUID)=arr
Response.Write(rSessionUID)
End Sub
Public Property Let ProductID(intN)
mProductID=intN
End Property
Public Property Let ActionFileName(strN)' = 0
mActionFileName=strN
End Property
Public Property Let ClipArtFolder(strN)' = 0
mClipArtFolder=strN
End Property
Public Property Let ClsFolder(strN)' = 0
mClsFolder=strN
End Property
Public Property Get SessionUID()
SessionUID=rSessionUID
End Property
Public Property Get Message()
Message=rMessage
End Property
Public Property Get ClipArtFile()
ClipArtFile=rClipArtFile
End Property
Public Property Get ActionFileName()
ActionFileName=mActionFileName
End Property
Public Property Get ClipArtFolder()
ClipArtFolder=mClipArtFolder
End Property
Public Property Get ClsFolder()
ClsFolder=mClsFolder
End Property
Public Property Get ProductID()
ProductID=mProductID
End Property
Public Sub View()
DrawImage
Response.Clear()
Set Image=Server.CreateObject("AspImage.Image")
Image.LoadImage Server.MapPath(mClsFolder&"images/test.jpg")
XClip=Image.MaxX
YClip=Image.MaxY
dim imageqwerty,arr,arr1,tmp2,tmp3,tmp
Set imageqwerty=Server.CreateObject("AspImage.Image")
imageqwerty.Autosize=true
imageqwerty.PadSize=0
Imageqwerty.BackgroundColor= RGB(&hff,&hff,&hff)
imageqwerty.MaxX=CDbl(700)
imageqwerty.MaxY=CDbl(1300)
Imageqwerty.BrushStyle= 1
Imageqwerty.BrushColor= RGB(&h99,&hcc,&hff)
Imageqwerty.FillRect ((700-XClip)/2)-10,2,((700-XClip)/2)+XClip+10,YClip+22
'imageqwerty.Loadimage Server.MapPath(mClsFolder&"images/test.jpg")
Imageqwerty.AddImage Server.MapPath(mClsFolder&"images/test.jpg"), (700-XClip)/2,12
imageqwerty.FontColor=vbBlack
imageqwerty.FontName="Arial"
imageqwerty.FontSize=9
imageqwerty.Bold=True
imageqwerty.Italic=False
ins_h=imageqwerty.TextHeight ("M")+4
imageqwerty.X=2
imageqwerty.Y=YClip+ins_h+22
if int(Request.Form("larNumTextLines"))>0 then
imageqwerty.Bold=True
tmp="Text Information"
imageqwerty.X=2
imageqwerty.TextOut tmp, imageqwerty.X, imageqwerty.Y, false
imageqwerty.Y=imageqwerty.Y+ins_h
imageqwerty.X=2
'2 15 <15 200 <15 123 <15 32 <15 68 <15 88 <15 88 <15 46 <15
imageqwerty.Italic=True
arr=Array(" # "," Text "," Font "," Size"," Style"," Align")
arr1=Array(15,230,100,100,68,46)
j=2
For i=Lbound(arr) to Ubound(arr)
tmp=arr(i)
imageqwerty.TextOut tmp, imageqwerty.X, imageqwerty.Y, false
j=j+arr1(i)
imageqwerty.X=j
next
imageqwerty.Italic=False
imageqwerty.Bold=False
j=6
imageqwerty.X=2
imageqwerty.y=imageqwerty.y+ins_h
For i = 1 to int(Request.Form("larNumTextLines"))
tmp="Arial"
Select Case Request.Form("larTextFontStyle"&i)
Case "0" tmp1="Plain"
Case "1" tmp1="Bold"
Case "2" tmp1="Italic"
Case "3" tmp1="Bold Italic"
End Select
Select Case Request.Form("larTextAlignment"&i)
Case "0" tmp2="Center"
Case "1" tmp2="Left"
Case "2" tmp2="Right"
End Select
tmp3=""
if int(Request.Form("larTextFontSize"&i)/48)>0 then
tmp3=int(Request.Form("larTextFontSize"&i)/48) &" "
end if
Select Case (Request.Form("larTextFontSize"&i) mod 48)
Case 6 :tmp3=""& tmp3 & "1/8"""
Case 12:tmp3=""& tmp3 & "1/4"""
Case 18:tmp3=""& tmp3 & "3/8"""
Case 24:tmp3=""& tmp3 & "1/2"""
Case 30:tmp3=""& tmp3 & "5/8"""
Case 36:tmp3=""& tmp3 & "3/4"""
Case 42:tmp3=""& tmp3 & "7/8"""
Case Else: tmp3=""& tmp3 & """"
End Select
arr=Array(Cstr(i),Cstr(Request.Form("larText"&i)),Cstr(tmp),Cstr(tmp3),Cstr(tmp1),Cstr(tmp2))
For z=Lbound(arr) to Ubound(arr)
tmp=arr(z)
imageqwerty.TextOut tmp, imageqwerty.X, imageqwerty.Y, false
j=j+arr1(z)
imageqwerty.X=j
next
imageqwerty.y=imageqwerty.y+ins_h
imageqwerty.X=2
j=6
Next
end if
imageqwerty.FileName = Server.MapPath(mClsFolder&"images/test3.jpg")
imageqwerty.Saveimage
Randomize
%>
<%
End Sub
Public Sub Play()
if Request.Form("larForm")="FirstForm" then
WriteSecondForm
elseif Request.Form("larForm")="SecondForm" then
WriteThirdForm
elseif Request.Form("larForm")="ThirdForm" then
DrawImage
WriteLastForm
elseif Request.Form("larForm")="LastForm" then
DrawImage
WriteLastForm
Else
WriteFirstForm
End if
End Sub
Private Sub DrawImage()
Dim Image,i,j,x,y,z
Dim ins_w,ins_h,drw_w,drw_h,alltxt_h
Dim imagecolor,borderthick,maxtext,tmp,tmp1
Set Image=Server.CreateObject("AspImage.Image")
Image.Autosize=false
Image.PadSize=0
Select Case mBackGroundName
Case "red" : Image.BackgroundColor = RGB(&hCC,&h00,&h00) 'vbred
Case "green" : Image.BackgroundColor = RGB(&h00,&hCC,&h00) 'vbgreen
Case "blue" : Image.BackgroundColor = RGB(&h00,&h00,&hCC) 'vbblue
Case "white" : Image.BackgroundColor = RGB(&hff,&hff,&hff)
Case "yellow" : Image.BackgroundColor = RGB(&hff,&hff,&h00)
Case "black" : Image.BackgroundColor = RGB(&h00,&h00,&h00)
End Select
Image.ClearImage
Image.MaxX = CDBL(Request.Form("larWidth")) *72
Image.MaxY = CDbl(Request.Form("larHeight")) *72
Select Case mBackGroundName
Case "red","green","blue","white","yellow","black"
Case else :
Set ImageClip=Server.CreateObject("AspImage.Image")
ImageClip.LoadImage Server.MapPath(mClipArtFolder&mBackGroundName)
ImageClip.ResizeR Image.MaxX,Image.MaxY
ImageClip.FileName = Server.MapPath(mClipArtFolder&"test4.jpg")
ImageClip.SaveImage
Image.AddImage Server.MapPath(mClipArtFolder&"test4.jpg"),1,1
End Select
x=0
y=0
z=0
ins_w=0
ins_h=0
alltxt_h=1
drw_w=Image.MaxX
drw_h=Image.MaxY
borderthick=0
maxtext=0
Select Case mTextColorName
Case "red" : imagecolor = RGB(&hCC,&h00,&h00) 'vbred
Case "green" : imagecolor = RGB(&h00,&hCC,&h00) 'vbgreen
Case "blue" : imagecolor = RGB(&h00,&h00,&hCC) 'vbblue
Case "white" : imagecolor = RGB(&hff,&hff,&hff)
Case "yellow" : imagecolor= RGB(&hff,&hff,&h00)
Case "black" : imagecolor = RGB(&h00,&h00,&h00)
Case else : imagecolor = RGB(&h00,&h00,&h00) 'vbblack
End Select
If int(Request.Form("larNumTextLines"))>0 then
For i=1 to Int(Request.Form("larNumTextLines"))
Image.FontSize=int(Request.Form("larTextFontSize"&i))
if int(Request.Form("larTextFontStyle"&i))=1 then
Image.Bold=True
Image.Italic=False
elseif int(Request.Form("larTextFontStyle"&i))=2 then
Image.Bold=False
Image.Italic=True
elseif int(Request.Form("larTextFontStyle"&i))=3 then
Image.Bold=True
Image.Italic=True
else
Image.Bold=False
Image.Italic=False
end if
ins_h=Image.TextHeight ("M")
alltxt_h=alltxt_h+1+ins_h+1
Next
y=(drw_h-alltxt_h)/2
Image.Y=y
End if
If int(Request.Form("larNumTextLines"))>0 then
Image.FontColor=imagecolor
For i=1 to Int(Request.Form("larNumTextLines"))
Select Case int(Request.Form("larTextFont"&i))
Case 1:Image.FontName="Times New Roman"
Case 2:Image.FontName="Courier"
Case 3:Image.FontName="Comic Sans MS"
Case Else:Image.FontName="Arial"
End Select
Image.FontSize=int(Request.Form("larTextFontSize"&i))
if int(Request.Form("larTextFontStyle"&i))=1 then
Image.Bold=True
Image.Italic=False
elseif int(Request.Form("larTextFontStyle"&i))=2 then
Image.Bold=False
Image.Italic=True
elseif int(Request.Form("larTextFontStyle"&i))=3 then
Image.Bold=True
Image.Italic=True
else
Image.Bold=False
Image.Italic=False
end if
ins_w=Image.TextWidth (Request.Form("larText"&i))
If int(maxtext)int(Image.MaxY-borderthick) then
rMessage=rMessage &"Image Elements exceeds max height. "
End if
If int(maxtext)>int(Image.MaxX-borderthick) then
rMessage=rMessage &"Image Elements exceeds max width. "
End if
Image.FileName = Server.MapPath(mClsFolder&"images/test.jpg")
if Image.SaveImage then
if IsNumeric(Request.Form("larStampZoom")) and Request.Form("larStampZoom")<>"" then
Image.LoadImage Server.MapPath(mClsFolder&"images/test.jpg")
Image.ResizeR Image.MaxX*(int(REquest.Form("larStampZoom"))/100),Image.MaxY*(int(REquest.Form("larStampZoom"))/100)
Image.FileName = Server.MapPath(mClsFolder&"images/test.jpg")
Image.SaveImage
elseif Request.Form("larStampZoom")="" then
Image.LoadImage Server.MapPath(mClsFolder&"images/test.jpg")
Image.ResizeR Image.MaxX*(50/100),Image.MaxY*(50/100)
Image.FileName = Server.MapPath(mClsFolder&"images/test.jpg")
Image.SaveImage
end if
Randomize%>
<%
else
rMessage=""&Image.Error&""
end if
if rMessage<>"" then
Response.Write "
"& rMessage &"
"
end if
End Sub
Private Sub WriteOtherHiddenVar()
For each i in Request.Form
if Left(i,3)<>"lar" then
Response.Write ""
end if
Next
End Sub
Private Sub WriteWidthHeight()%>
" readonly>
" readonly>
Width
" size="3" readonly> "
Height
" size="3" readonly> "
<%if Request.Form("larForm")="ThirdForm" or Request.Form("larForm")="LastForm" then%>
Zoom
%
<%end if%>
<%
End Sub
Private Sub WriteFirstForm()%>
<%WriteOtherHiddenVar%>
<%
Session("larCustom")=""
End Sub
Private Sub WriteSecondForm()%>
<%WriteOtherHiddenVar%>
<%
End Sub
Private Sub WriteThirdForm()%>
<%
End Sub
Private Sub WriteLastForm()%>
<%
Dim larrycart',tmp
larrycart=""
larrycart=Request.Form("larNumTextLines") &";0;0;0"
larrycart=larrycart &";0;0;100;;;"
larrycart=larrycart &""& rClipArtFile
tmp=""
if int(Request.Form("larNumTextLines"))>0 then
For i=1 to int(Request.Form("larNumTextLines"))
if tmp="" then
tmp=Request.Form("larText"&i) &"0:"& Request.Form("larTextFontSize"&i) &":"& Request.Form("larTextFontStyle"&i) &":"& Request.Form("larTextSpaceAbove"&i) &":"& Request.Form("larTextSpaceBelow"&i) &":"& Request.Form("larTextAlignment"&i)
else
tmp=tmp &""& Request.Form("larText"&i) &"0:"& Request.Form("larTextFontSize"&i) &":"& Request.Form("larTextFontStyle"&i) &":"& Request.Form("larTextSpaceAbove"&i) &":"& Request.Form("larTextSpaceBelow"&i) &":"& Request.Form("larTextAlignment"&i)
end if
Next
end if
larrycart=larrycart &""& tmp
larrycart=larrycart &""& mProductID &""& Request.Form("larWidHei") &""& Request.Form("larWidHei1") &""& Request.Form("larWidth") &""& Request.Form("larHeight")
Session.Contents("larrytmpcart")=larrycart
End Sub
End Class%>