SQL 之 {$CreateImage({$Field(photourl,Text,0,...,0,)},{$Param(1)},{$Param(2)})} 问世 For V6
该功能用于在自定义SQL 中动态处理图片
修改kesion.label.sqlcls.asp
GetCirLabelContent=GetCirLabelContent &TempStr
Else
Exit For
End If
KS_RS_Obj.MoveNext
Next
GetCirLabelContent=MySplitField(GetCirLabelContent)
GetCirLabelContent=CreateImage(GetCirLabelContent)
GetCirLabelContent=CurrClassPosition(GetCirLabelContent)
GetCirLabelContent=CurrInfoPosition(GetCirLabelContent)
End Function
Function CreateImage(lpFieldValue)
Dim regEx, Matches, Match
if instr(lpFieldValue,"CreateImage")<=0 then
CreateImage=lpFieldValue
else
Dim FieldParam,FieldParamArr,mytempValue,mytempNum,mytarget,templpFieldValue,file,filepath,filename,filebasename,fileextname
Dim T:Set T=New Thumb
Set regEx = New RegExp
regEx.Pattern = "{\$CreateImage\([^{\$}]*}"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(lpFieldValue)
For Each Match In Matches
FieldParam = Replace(Replace(Match.Value,"{$CreateImage(",""),")}","")
FieldParamArr = Split(FieldParam,",")
file=FieldParamArr(0)
filepath=left(file,instrrev(file,"/"))
filename=mid(file,instrrev(file,"/")+1)
filebasename=split(filename,".")(0)
call T.CreateThumb(FieldParamArr(0),FieldParamArr(1),FieldParamArr(2),1,0,filepath&filebasename&"_S.jpg")
lpFieldValue=Replace(lpFieldValue,Match.Value,filepath&filebasename&"_S.jpg")
Next
CreateImage=lpFieldValue
end if
End Function