ASPJPEG綜合操作的CLASS類
<%
'aspjpeg綜合操作class
class aspjpeg
dim aspjpeg_obj,obj
private img_mathpath_from,img_mathpath_to,img_reduce_size,coverif
private img_frame_size,img_frame_color,img_frame_solid,img_frame_width,img_frame_height
private img_font_content,img_font_family,img_font_color,img_font_quality,img_font_size,img_font_bold,img_font_x,img_font_y
private img_picin_path,img_picin_x,img_picin_y
'--------------取原文件路徑
public property let mathpathfrom(strtype)
img_mathpath_from=strtype
end property
'--------------取文件保存路徑
public property let mathpathto(strtype)
img_mathpath_to=strtype
end property
'--------------保存文件時是否覆蓋已有文件
public property let covepro(lngsize)
if lngsize=0 or lngsize=1 or lngsize=true or lngsize=false then
coverif=lngsize
end if
end property
'---------------取縮略圖/放大圖 縮略值
public property let reducesize(lngsize)
if isnumeric(lngsize) then
img_reduce_size=lngsize
end if
end property
'---------------取描邊屬性
'邊框粗細
public property let framesize(lngsize)
if isnumeric(lngsize) then
img_frame_size=clng(lngsize)
end if
end property
'邊框?qū)挾?nbsp;
public property let framewidth(lngsize)
if isnumeric(lngsize) then
img_frame_width=clng(lngsize)
end if
end property
'邊框高度
public property let frameheight(lngsize)
if isnumeric(lngsize) then
img_frame_height=clng(lngsize)
end if
end property
'邊框顏色
public property let framecolor(strtype)
if strtype<>"" then
img_frame_color=strtype
end if
end property
'邊框是否加粗
public property let framesolid(lngsize)
if lngsize=1 or lngsize=0 or lngsize=true or lngsize=false then
img_frame_solid=lngsize
end if
end property
'---------------取插入文字屬性
'插入的文字
public property let content(strtype)
if strtype<>"" then
img_font_content=strtype
end if
end property
'文字字體
public property let fontfamily(strtype)
if strtype<>"" then
img_font_family=strtype
end if
end property
'文字顏色
public property let fontcolor(strtype)
if strtype<>"" then
img_font_color=strtype
end if
end property
'文字品質(zhì)
public property let fontquality(lngsize)
if isnumeric(lngsize) then
img_font_quality=clng(lngsize)
end if
end property
'文字大小
public property let fontsize(lngsize)
if isnumeric(lngsize) then
img_font_size=clng(lngsize)
end if
end property
'文字是否加粗
public property let fontbold(lngsize)
if lngsize=1 or lngsize=0 or lngsize=true or lngsize=false then
img_font_bold=lngsize
end if
end property
'輸入文字的x坐標
public property let fontx(lngsize)
if isnumeric(lngsize) then
img_font_x=clng(lngsize)
end if
end property
'輸入文字的y坐標
public property let fonty(lngsize)
if isnumeric(lngsize) then
img_font_y=clng(lngsize)
end if
end property
'---------------取插入圖片屬性
'插入圖片的路徑
public property let picinpath(strtype)
img_picin_path=strtype
end property
'圖片插入的x坐標
public property let picinx(lngsize)
if isnumeric(lngsize) then
img_picin_x=clng(lngsize)
end if
end property
'圖片插入的y坐標
public property let piciny(lngsize)
if isnumeric(lngsize) then
img_picin_y=clng(lngsize)
end if
end property
private sub class_initialize()
set aspjpeg_obj=createobject("persits.jpeg")
img_mathpath_from=""
img_mathpath_to=""
img_reduce_size=150
img_frame_size=1
'img_frame_width=0
'img_frame_height=0
'img_frame_color="&h000000"
'img_frame_bold=false
img_font_content="goldenleaf"
'img_font_family="arial"
'img_font_color="&h000000"
img_font_quality=3
img_font_size=14
'img_font_bold=false
img_font_x=10
img_font_y=5
'img_picin_x=0
'img_picin_y=0
coverif=1
end sub
private sub class_terminate()
err.clear
set aspjpeg_obj=nothing
end sub
'判斷文件是否存在
private function fileis(path)
set fsos=server.createobject("scripting.filesystemobject")
fileis=fsos.fileexists(path)
set fsos=nothing
end function
'判斷目錄是否存在
private function folderis(path)
set fsos=server.createobject("scripting.filesystemobject")
folderis=fsos.folderexists(path)
set fsos=nothing
end function
'*******************************************
'函數(shù)作用:取得當前文件的上一級路徑
'*******************************************
private function updir(byval d)
if len(d) = 0 then
updir=""
else
updir=left(d,instrrev(d,"\")-1)
end if
end function
private function errors(errors_id)
select case errors_id
case "0"
errors="指定文件不存在"
case 1
errors="指定目錄不存在"
case 2
errors="已存在相同名稱文件"
case 3
errors="參數(shù)溢出"
end select
end function
'取圖片寬度
public function imginfo_width(img_mathpath)
if not(fileis(img_mathpath)) then
'exit function
imginfo_width=errors(0)
else
aspjpeg_obj.open img_mathpath
imginfo_width=aspjpeg_obj.width
end if
end function
'取圖片高度
public function imginfo_height(img_mathpath)
if not(fileis(img_mathpath)) then
'exit function
imginfo_height=errors(0)
else
aspjpeg_obj.open img_mathpath
imginfo_height=aspjpeg_obj.height
end if
end function
'生成縮略圖/放大圖
public function img_reduce()
if not(fileis(img_mathpath_from)) then
img_reduce=errors(0)
exit function
end if
if not(folderis(updir(img_mathpath_to))) then
img_reduce=errors(1)
exit function
end if
if coverif=0 or coverif=false then
if fileis(img_mathpath_to) then
img_reduce=errors(2)
exit function
end if
end if
aspjpeg_obj.open img_mathpath_from
aspjpeg_obj.preserveaspectratio = true
if aspjpeg_obj.originalwidth>aspjpeg_obj.originalheight then
aspjpeg_obj.width=img_reduce_size
else
aspjpeg_obj.height=img_reduce_size
end if
if aspjpeg_obj.originalwidth>img_reduce_size or aspjpeg_obj.originalheight>img_reduce_size then
if aspjpeg_obj.width
'aspjpeg綜合操作class
class aspjpeg
dim aspjpeg_obj,obj
private img_mathpath_from,img_mathpath_to,img_reduce_size,coverif
private img_frame_size,img_frame_color,img_frame_solid,img_frame_width,img_frame_height
private img_font_content,img_font_family,img_font_color,img_font_quality,img_font_size,img_font_bold,img_font_x,img_font_y
private img_picin_path,img_picin_x,img_picin_y
'--------------取原文件路徑
public property let mathpathfrom(strtype)
img_mathpath_from=strtype
end property
'--------------取文件保存路徑
public property let mathpathto(strtype)
img_mathpath_to=strtype
end property
'--------------保存文件時是否覆蓋已有文件
public property let covepro(lngsize)
if lngsize=0 or lngsize=1 or lngsize=true or lngsize=false then
coverif=lngsize
end if
end property
'---------------取縮略圖/放大圖 縮略值
public property let reducesize(lngsize)
if isnumeric(lngsize) then
img_reduce_size=lngsize
end if
end property
'---------------取描邊屬性
'邊框粗細
public property let framesize(lngsize)
if isnumeric(lngsize) then
img_frame_size=clng(lngsize)
end if
end property
'邊框?qū)挾?nbsp;
public property let framewidth(lngsize)
if isnumeric(lngsize) then
img_frame_width=clng(lngsize)
end if
end property
'邊框高度
public property let frameheight(lngsize)
if isnumeric(lngsize) then
img_frame_height=clng(lngsize)
end if
end property
'邊框顏色
public property let framecolor(strtype)
if strtype<>"" then
img_frame_color=strtype
end if
end property
'邊框是否加粗
public property let framesolid(lngsize)
if lngsize=1 or lngsize=0 or lngsize=true or lngsize=false then
img_frame_solid=lngsize
end if
end property
'---------------取插入文字屬性
'插入的文字
public property let content(strtype)
if strtype<>"" then
img_font_content=strtype
end if
end property
'文字字體
public property let fontfamily(strtype)
if strtype<>"" then
img_font_family=strtype
end if
end property
'文字顏色
public property let fontcolor(strtype)
if strtype<>"" then
img_font_color=strtype
end if
end property
'文字品質(zhì)
public property let fontquality(lngsize)
if isnumeric(lngsize) then
img_font_quality=clng(lngsize)
end if
end property
'文字大小
public property let fontsize(lngsize)
if isnumeric(lngsize) then
img_font_size=clng(lngsize)
end if
end property
'文字是否加粗
public property let fontbold(lngsize)
if lngsize=1 or lngsize=0 or lngsize=true or lngsize=false then
img_font_bold=lngsize
end if
end property
'輸入文字的x坐標
public property let fontx(lngsize)
if isnumeric(lngsize) then
img_font_x=clng(lngsize)
end if
end property
'輸入文字的y坐標
public property let fonty(lngsize)
if isnumeric(lngsize) then
img_font_y=clng(lngsize)
end if
end property
'---------------取插入圖片屬性
'插入圖片的路徑
public property let picinpath(strtype)
img_picin_path=strtype
end property
'圖片插入的x坐標
public property let picinx(lngsize)
if isnumeric(lngsize) then
img_picin_x=clng(lngsize)
end if
end property
'圖片插入的y坐標
public property let piciny(lngsize)
if isnumeric(lngsize) then
img_picin_y=clng(lngsize)
end if
end property
private sub class_initialize()
set aspjpeg_obj=createobject("persits.jpeg")
img_mathpath_from=""
img_mathpath_to=""
img_reduce_size=150
img_frame_size=1
'img_frame_width=0
'img_frame_height=0
'img_frame_color="&h000000"
'img_frame_bold=false
img_font_content="goldenleaf"
'img_font_family="arial"
'img_font_color="&h000000"
img_font_quality=3
img_font_size=14
'img_font_bold=false
img_font_x=10
img_font_y=5
'img_picin_x=0
'img_picin_y=0
coverif=1
end sub
private sub class_terminate()
err.clear
set aspjpeg_obj=nothing
end sub
'判斷文件是否存在
private function fileis(path)
set fsos=server.createobject("scripting.filesystemobject")
fileis=fsos.fileexists(path)
set fsos=nothing
end function
'判斷目錄是否存在
private function folderis(path)
set fsos=server.createobject("scripting.filesystemobject")
folderis=fsos.folderexists(path)
set fsos=nothing
end function
'*******************************************
'函數(shù)作用:取得當前文件的上一級路徑
'*******************************************
private function updir(byval d)
if len(d) = 0 then
updir=""
else
updir=left(d,instrrev(d,"\")-1)
end if
end function
private function errors(errors_id)
select case errors_id
case "0"
errors="指定文件不存在"
case 1
errors="指定目錄不存在"
case 2
errors="已存在相同名稱文件"
case 3
errors="參數(shù)溢出"
end select
end function
'取圖片寬度
public function imginfo_width(img_mathpath)
if not(fileis(img_mathpath)) then
'exit function
imginfo_width=errors(0)
else
aspjpeg_obj.open img_mathpath
imginfo_width=aspjpeg_obj.width
end if
end function
'取圖片高度
public function imginfo_height(img_mathpath)
if not(fileis(img_mathpath)) then
'exit function
imginfo_height=errors(0)
else
aspjpeg_obj.open img_mathpath
imginfo_height=aspjpeg_obj.height
end if
end function
'生成縮略圖/放大圖
public function img_reduce()
if not(fileis(img_mathpath_from)) then
img_reduce=errors(0)
exit function
end if
if not(folderis(updir(img_mathpath_to))) then
img_reduce=errors(1)
exit function
end if
if coverif=0 or coverif=false then
if fileis(img_mathpath_to) then
img_reduce=errors(2)
exit function
end if
end if
aspjpeg_obj.open img_mathpath_from
aspjpeg_obj.preserveaspectratio = true
if aspjpeg_obj.originalwidth>aspjpeg_obj.originalheight then
aspjpeg_obj.width=img_reduce_size
else
aspjpeg_obj.height=img_reduce_size
end if
if aspjpeg_obj.originalwidth>img_reduce_size or aspjpeg_obj.originalheight>img_reduce_size then
if aspjpeg_obj.width
相關(guān)文章
- ASP怎么談到應(yīng)用到類的?
- 檢測函數(shù) asp class
- 遭遇ASP類的事件設(shè)計
- ASP高亮類
- Object對象的一些的隱藏函數(shù)介紹
- 淺談ASP中的類
- 在VBScript中使用類
- ASP 類專題
- 代碼與頁面的分離
- ASP代碼的對象化
- 一個asp快速字符串連接類
- 一個簡單的asp數(shù)據(jù)庫操作類
- ASP類編寫詳細說明
- 實現(xiàn)支持邏輯搜索/單詞搜索/詞組搜索+支持OR/AND關(guān)鍵字的VBS CLASS!
- ASP類Class入門 推薦
- 創(chuàng)建一個ASP通用分頁類
- 如何編寫一個ASP類
- 一個ACCESS數(shù)據(jù)庫訪問的類第1/3頁
- 分頁類,異常類
- ASP 類 Class入門