private Function getimgs(str)
getimgs = ""
Set objRegExp1 = New RegExp
objRegExp1.IgnoreCase = True
objRegExp1.Global = True
objRegExp1.Pattern = "http://.+?"""
Set mm = objRegExp1.Execute(str)
For Each Match1 In mm
getimgs = getimgs & "||" & Left(Match1.Value, Len(Match1.Value) - 1)
Next
End Function
Function str2img()
Dim servername, objRegExp, strs, Matches, RetStr, arrimg, newimg, i, fname, states, arrnew, arrall
if baseurl<>"" then
If Right(baseurl, 1) <> "/" Then
baseurl = baseurl & "/"
End If
end if
if right(tofolder,1)<>"\" then
tofolder=tofolder&"\"
end if
Set objRegExp = New RegExp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = ""
strs = Trim(processstr)
Set Matches = objRegExp.Execute(strs)
For Each Match In Matches
RetStr = RetStr & getimgs(Match.Value)
Next
arrimg = Split(RetStr, "||")
allimg = ""
newimg = ""
For i = 1 To UBound(arrimg)
If arrimg(i) <> "" And InStr(allimg, arrimg(i)) < 1 Then
fname1 = baseurl & CStr(basefilename & i & Mid(arrimg(i), InStrRev(arrimg(i), ".")))
fname = tofolder & CStr(basefilename & i & Mid(arrimg(i), InStrRev(arrimg(i), ".")))
states = saveimage(arrimg(i), fname)
If states = True Then
allimg = allimg & "||" & arrimg(i)
newimg = newimg & "||" & fname1
End If
End If
Next
arrnew = Split(newimg, "||")
arrall = Split(allimg, "||")
For i = 1 To UBound(arrnew)
if i=1 then
firstoldimg=arrall(1)
firstnewimg=arrnew(1)
end if
strs = Replace(strs, arrall(i), arrnew(i))
Next
str2img = strs
End Function
end class
第一步用户登录的时候:由于有一个工作区,所以最好不要让多个用户用同一个帐号不然到时候有人登出的时候,将会造成其它人的工作丢失,这里最主要处理的是帐户登录的时候要对这个帐号锁定不允许重复登录(主要由FSO和数据库来实现,我就不多说了)。
|