<!-- #include file="../../../include.asp" -->

<%
'################################################
'   名称  :     
'   作成日:2003/
'   作成者:
'   目的  :
'   概要  :
'    <<表示>>
'    ・
'################################################
%>

<%
main()
Sub main()


	Dim a, b, basp, f1, ImageFile, l1
	Dim LeadBase, Lead2
	Dim tmp
	Dim PartLeft, PartTop, PartWidth, PartHeight, Zoom
	Dim SavePath, SaveMapPath, TempMapPath
	Dim FileName
	Dim Matrix

	Dim RouteType


	Dim fso
	Set fso = CreateObject("Scripting.FileSystemObject")


	a=Request.TotalBytes
	b=Request.BinaryRead(a)
	set basp=Server.CreateObject("basp21")


	Zoom = basp.Form(b,"Zoom")
	If 1 = 1 Then	
		PartLeft = basp.Form(b,"PartLeft")
		PartTop = basp.Form(b,"PartTop")
		PartWidth = basp.Form(b,"PartWidth")
		PartHeight = basp.Form(b,"PartHeight")
		Zoom = basp.Form(b,"Zoom")
		FileName = basp.Form(b,"FileName")
		RouteType = basp.Form(b,"RouteType")
		Matrix = basp.Form(b,"Matrix")

		f1 = basp.FormFileName(b,"ImageFile")
		If f1 <> "" Then
			ImageFile=Mid(f1,InstrRev(f1,"\")+1)
			ImageFile = Replace(ImageFile, ".bmp", ".jpg")

			SaveMapPath = Server.MapPath("/" & HomeAlias & "/data/gazokako") & "/" & ImageFile
			SavePath = "/" & HomeAlias & "/data/gazokako/" & ImageFile
			'TempMapPath = basp.GetTempFile() 'Windowsテンポラリだと「ファイルが見つかりません」になるケースがあったので廃止(211021小野)
			TempMapPath = Server.MapPath("/" & HomeAlias & "/data/gazokako") & "/" & GB_GakuseiNo & Year(Now) & Month(Now) & Day(Now) & Hour(Now) & Minute(Now) & Second(Now) & ImageFile

			l1=basp.FormSaveAs(b,"ImageFile",TempMapPath)
Response.Write(l1 & "<br>")
		Else


			On Error Resume Next
			fso.DeleteFile(Server.MapPath(FileName) & ".jpg")
			On Error GoTo 0
			fso.MoveFile Server.MapPath(FileName), Server.MapPath(FileName) & ".jpg"

			TempMapPath = Server.MapPath(FileName) & ".jpg"
			SaveMapPath = Server.MapPath(FileName)
			SavePath = FileName

			ImageFile = Mid(FileName,InstrRev(FileName,"/")+1)



		End If
	End if


	Set LeadBase = Server.CreateObject("LEAD.LeadCtrl.121") 
	Set Lead2 = Server.CreateObject("LEAD.LeadCtrl.121") 
Response.Write(TempMapPath & "<br>")
'Exit Sub
	tmp = LeadBase.Load(TempMapPath, 0, 0, 1)
	tmp = LeadBase.ColorRes(24, 0, 0, 0)
	tmp = LeadBase.Rotate(Matrix * 100, 1, 0)


	tmp = Lead2.CreateBitmap(PartWidth, PartHeight, 24)
	tmp = Lead2.Fill(256*256*256-1)
	tmp = Lead2.ColorRes(24, 0, 0, 0)
	tmp = Lead2.Combine(0, 0, PartWidth, PartHeight, LeadBase.Bitmap,PartLeft, PartTop,  0)
	tmp = Lead2.Size(PartWidth * Zoom / 100, PartHeight * Zoom / 100, 0)



	tmp = Lead2.Save(SaveMapPath, 10, 24, 2, 0)
Response.Write("-<br>")
Response.Write(PartLeft)
Response.Write("-")
Response.Write(PartTop)
Response.Write("-")
Response.Write(PartWidth)
Response.Write("-")
Response.Write(PartHeight)
Response.Write("-<br>")
Response.Write(Zoom)
Response.Write("-<br>")
Response.Write(SaveMapPath)

Response.Write("-<br>")
Response.Write("<body bgcolor='#ff0000'>")
Response.Write("<img src='" & SavePath & "'>")
Response.Write("<a href='gazokako_view.asp?FileName=" & ImageFile & "'>次のページ</a>")
Response.Write("</body>")

On Error Resume Next
	fso.DeleteFile(TempMapPath)
On Error GoTo 0

	Response.Redirect("gazokako_view.asp?FileName=" & ImageFile & "&RouteType=" & RouteType)


End Sub
%>