Regular customer requirements to save the original IMG already in the attribute, depressed, continue to change
The code is as follows:
function Shownew (content,ntype)
Shownew = ""
if (ntype = 1) Then
Shownew = shownew & "<table width=100% >"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td width=700 align=center style= ' word-break:break-all ' valign=top>" &ShowPic ( Content) & "</TD>"
Shownew = shownew & "</TR>"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td valign=top style= ' Word-break:break-all ' >" &onlyword (Content) & "</TD>"
Shownew = shownew & "</TR>"
Shownew = shownew & "</TABLE>"
ElseIf (ntype = 2) Then
Shownew = shownew & "<table width= ' 100% ' >"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td style= ' Word-break:break-all ' valign=top>" &onlyword (content) & "</TD>"
Shownew = shownew & "</TR>"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td align=center width=700 valign=top style= ' Word-break:break-all ' >" &ShowPic ( Content) & "</TD>"
Shownew = shownew & "</TR>"
Shownew = shownew & "</TABLE>"
ElseIf (ntype = 3) Then
Shownew = shownew & "<TABLE>"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td width=100 align=center valign=top>" &showpic (content) & "</TD>"
Shownew = shownew & "<td width=80% style= ' word-break:break-all ' valign=top>" &onlyword (content) & " </TD> "
Shownew = shownew & "</TR>"
Shownew = shownew & "</TABLE>"
ElseIf (ntype = 4) Then
Shownew = shownew & "<TABLE>"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td width=80% valign=top style= ' Word-break:break-all ' >" &onlyword (Content) & " </TD> "
Shownew = shownew & "<td width=100 valign=top align=center>" &showpic (content) & "</TD>"
Shownew = shownew & "</TR>"
Shownew = shownew & "</TABLE>"
Else
Shownew = Shownew &content
End If
End Function
' Show the extracted picture
function Showpic (STRNG)
Set regEx2 = new REGEXP
Regex2.pattern = "(src=) (' |") &CHR (&) | )? (. [^'| |" &CHR (& "]*)" (\.) (Jpg|gif|png|bmp|jpeg) ('|" &CHR (& "| |>)"? ' Set mode.
Regex2.ignorecase = True ' Sets whether character case is case-sensitive.
Regex2.global = True ' Sets global availability.
Showpic = ""
Imageurl= Regexpexecute (STRNG)
Imageurls = Split (ImageUrl, "{| ldiv|} ")
For i = LBound (Imageurls) to (UBound (imageurls)-1)
Set Matches2 = Regex2.execute (Imageurls (i)) ' performs a search.
For each Match2 in Matches2 ' Traversal matching collection.
' Full img tag
Newpic = LCase (Imageurls (i))
' If no custom border add border=0, other original attributes remain
if (InStr (Newpic, "border") =false) then Newpic = Left (Newpic,len (newpic)-1) + "border= ' 0 ' >"
if (InStr (Newpic, "width") =false) then Newpic = Left (Newpic,len (newpic)-1) + "width= ' >"
Newpic = "<a style= ' padding:20px ' href= '" &match2.submatches (2) &match2.submatches (3) & Match2.submatches (4) & "' >" & newpic & "</a>"
Showpic = showpic & Newpic
Next
Next
Set regEx2 = Nothing
End Function
' Extract the picture from the content
Function Regexpexecute (STRNG)
Dim regEx, Match, matches ' Set variable.
Set regEx = New RegExp ' establishes a regular expression.
Regex.pattern = "(<) (. [ ^<]*) (src=) (' | ') &CHR (&) | )? (. [^ ' |\s| ' &CHR (& "]*)" (\.) (Jpg|gif|png|bmp|jpeg) ('|" &CHR (& "|\s|>") (. [ ^>]*) (>) "' Set mode.
Regex.ignorecase = True ' Sets whether character case is case-sensitive.
Regex.global = True ' Sets global availability.
Set matches = Regex.execute (strng) ' performs a search.
For the match in matches ' traversal matching collection.
Values=values&match.val