⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 picformat.asp

📁 视频源代码 视频源代码
💻 ASP
字号:
<%
Function checkImageFormat(checkdata)
' A 图形格式
' B 图形高度
' C 图形宽度
' D 图形颜色
flag=0
' 0 非 jpg/gif/png 类型图片
' 1 jpg/gif/png 类型图片

'-- 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

    strTarget = chrb(255) & chrb(216) & chrb(255)
    flgFound = instrb(checkdata, strTarget)

    lngPos = flgFound + 2
    ExitLoop = false

    Do while ExitLoop = False and lngPos < lngSize

      Do while ascb(midb(checkdata, lngPos, 1)) = 255 and lngPos < lngSize
        lngPos = lngPos + 1
      Loop

      If ascb(midb(checkdata, lngPos, 1)) < 192 or ascb(midb(checkdata, lngPos, 1)) > 195 then
        lngMarkerSize = lngConvert2(midb(checkdata, lngPos + 1, 2))
        lngPos = lngPos + lngMarkerSize + 1
      Else
        ExitLoop = True
      End If

    Loop

    i_Height = lngConvert2(midb(checkdata, lngPos +4, 2))
    i_Width  = lngConvert2(midb(checkdata, lngPos +6, 2))
    i_Depth  = 2 ^ (ascb(midb(checkdata, lngPos + 8, 1)) * 8)
   
    msgstr02=","& i_height & "," & i_width
    flag=2
  Else
    flag=0
  End if
End if

'-- 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"

    i_width=lngConvert(midb(checkdata,7,2))
    i_height=lngConvert(midb(checkdata,9,2))
    i_Depth = 2 ^ ((ascb(midb(checkdata, 11, 1)) and 7) + 1)
    msgstr04=","& i_height & ","& i_width 

    flag=2
  Else
    flag=0
  End If
End If

'-- 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"

    i_Width  = lngConvert2(midb(checkdata, 19, 2))
    i_Height = lngConvert2(midb(checkdata, 23, 2))
    i_Depth  = lngConvert(midb(checkdata, 25, 2))

    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)))
          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
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -