<%
'---------------------------------------RETURN THE IMAGE FORMAT--------------------
function checkImageFormat(checkdata)
'--return: A,B,C (A is image format; B is height pixels; C is width pixels; D is color depth)
flag=0 '''''''0 is not jpg/gif/png image; 1 is jpg/gif/png
'-------------------------------------------------------check jpg----------------
if flag=0 then
tempstr=Leftb(checkdata,10)
tstr=chrb(255)&chrb(216)&chrb(255)&chrb(224)&chrb(0)&chrb(16)&chrb(74)&chrb(70)&chrb(73)&chrb(70)
if strcomp(tempstr,tstr,0)=0 then
msgstr01="jpg"
lngSize = len(checkdata)
flgFound = 0
msgstr02=","& i_height & "," & i_width
flag=2
else
flag=0
end if
end if
'--------------------------------------------------check gif--------------------------------
if flag=0 then
tempstr=Leftb(checkdata,6)
tstr=chrb(71)&chrb(73)&chrb(70)&chrb(56)&chrb(57)&chrb(97)
tstr2=chrb(71)&chrb(73)&chrb(70)&chrb(56)&chrb(55)&chrb(97)
if strcomp(tempstr,tstr,0)=0 or strcomp(tempstr,tstr2)=0 then
msgstr03="gif"
'---------------------------------------------------check png------------------------------
if flag=0 then
tempstr=Leftb(checkdata,4)
tstr=chrb(137)&chrb(80)&chrb(78)&chrb(71)
if strcomp(tempstr,tstr,0)=0 then
msgstr05="png"
select case ascb(right(i_Depth,1))
case 0
i_Depth = 2 ^ (asc(left(i_Depth, 1)))
gfxSpex = True
case 2
i_Depth = 2 ^ (asc(left(i_Depth, 1)) * 3)
gfxSpex = True
case 3
i_Depth = 2 ^ (asc(left(i_Depth, 1))) '8
gfxSpex = True
case 4
i_Depth = 2 ^ (asc(left(i_Depth, 1)) * 2)
gfxSpex = True
case 6
i_Depth = 2 ^ (asc(left(i_Depth, 1)) * 4)
gfxSpex = True
case else
i_Depth = -1
end select
msgstr06=","& i_height & ","& i_width
flag=2
else
flag=0
end if
end if
if flag=0 then
msgstr07="no image"
end if
msgstr=msgstr01 & msgstr02 & msgstr03 & msgstr04 & msgstr05 & msgstr06 & msgstr07
checkImageFormat=msgstr
end function
function lngConvert2(strTemp)
str1=leftb(strTemp,1)
str2=rightb(strTemp,1)
lngConvert2 = clng(ascb(str2) + ((ascb(str1) * 256)))
end function
function lngConvert(strTemp)
str1=leftb(strTemp,1)
str2=rightb(strTemp,1)
len1=ascb(str1)
len2=ascb(str2)
lngConvert = clng(ascb(str1) + ascb(str2) * 256)
end function
'------------------------Copyright by qinls------------------
%>
<% if arrayMessage(1)>150 OR arrayMessage(2)>100 then %>
<script language="javascript">
alert("您所选择的图片的尺寸不符合要求!应在 高*宽 150*100 之间")
window.location="SP.htm"
</script>
<% Else
Set Cn=server.CreateObject("ADODB.connection")
Cn.ConnectionString="Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("pic.mdb")
Cn.Open
Set Rs=Server.createobject("ADODB.Recordset")
Rs.Open "SELECT * FROM T1 where ID is Null",Cn,1,3
Rs.Addnew
Rs.Fields("IMG").appendchunk mydata
Rs.Update
Rs.Close
Set Rs=nothing
Set Cn=nothing
End if
%>
<script language="Javascript">
window.location="SP.htm"
</script>
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
SearchPic.asp
<script language="javascript">
</script>
<%
Set Cn=server.CreateObject("ADODB.connection")
Cn.ConnectionString="Driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("pic.mdb")
Cn.Open
Set Rs=Server.Createobject("ADODB.Recordset")