一聚教程网:一个值得你收藏的教程网站

热门教程

asp 检测空间是否支持aspjpeg组件并生成缩略图

时间:2022-06-29 14:25:33 编辑:袖梨 来源:一聚教程网

'函数名:isobjinstalled
'作  用:检查组件是否已经安装
'参  数:strclassstring ----组件名
'返回值:true  ----已经安装
'        false ----没有安装

function isobjinstalled(strclassstring)
    on error resume next
    isobjinstalled = false
    err = 0
    dim xtestobj
    set xtestobj = server.createobject(strclassstring)
    if 0 = err then isobjinstalled = true
    set xtestobj = nothing
    err = 0
end function


'缩略图函数

function jpegsmall(originalpic,s_opic,sp)
 dim jpeg,picpath,smallpathpic
 if originalpic = "" or isnull(originalpic) then
  jpegsmall = ""
 else
  if isobjinstalled("persits.jpeg") then
   set jpeg = server.createobject("persits.jpeg")
   opicpath = s_opic
   picpath = server.mappath(originalpic)
   smallpathpic = server.mappath(opicpath)
   jpeg.open picpath
   jpeg.width = jpeg.originalwidth / sp
   jpeg.height = jpeg.originalheight / sp
   jpeg.save smallpathpic
   jpeg.close:set jpeg = nothing
   jpegsmall = s_opic
  else
   jpegsmall = ""
  end if
 end if
end function

 

热门栏目