'Display news in text or specific image mode
Function shownew (content, ntype)
Shownew = ""
If (ntype = 1) then
Shownew = shownew & "<Table width = 100%>"
Shownew = shownew & "<tr>"
Shownew = shownew & "<TD width = 600 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 = '000000'>"
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 width = 600 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 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>" & showpic (content) & "</TD>"
Shownew = shownew & "</tr>"
Shownew = shownew & "</table>"
Else
Shownew = shownew & "<Table> <tr> <TD style = 'word-break: break-all'> "& content &" </TD> </tr> </table>"
End if
End Function
'Show extracted Images
Function showpic (strng)
Showpic = ""
Imageurl = regexpexecute (strng)
Imageurls = Split (imageurl, "<br> ")
For I = lbound (imageurls) to (ubound (imageurls)-1)
Showpic = showpic & ("<a href = '" & imageurls (I) & "'target = _ blank> <image src ='" & imageurls (I) & "'border = '0' alt = 'click here to browse the image in the new window 'onload = 'javascript: If (this. width> 180) This. width = 180 '> </a> ")
Next
End Function
'Extract the image from the content
Function regexpexecute (strng)
Dim RegEx, match, matches 'to create a variable.
Set RegEx = new Regexp 'to create a regular expression.
RegEx. pattern = "(src =) ('|" & CHR (34) & "| )? (. [^ '|/S | "& CHR (34) &"] *) (/.) (JPG | GIF | PNG | BMP | JPEG) ('| "& CHR (34) &" |/S |> )? "'Setting mode.
'Regex. pattern = "(src =) ('|" & CHR (34) & "| )? (. [^ '| "& CHR (34) &"] *) (/.) (JPG | GIF | PNG | BMP | JPEG) ('| "& CHR (34) &" |> )? "'Setting mode.
'Regex. pattern = "(S | S) (R | r) (C | C) = ('|" + CHR (34) + ") (/w | // | /.) + ('| "+ CHR (34) +" | * |> )? "'Setting mode.
RegEx. ignorecase = true' specifies whether the characters are case sensitive.
RegEx. Global = true' to set global availability.
Set matches = RegEx. Execute (strng) 'to execute the search.
For each match in matches 'traverses the matching set.
Values = Values & Match. submatches (2) & Match. submatches (3) & Match. submatches (4) & "<br>"
Next
Regexpexecute = values
End Function
'Delete the image-related code in the content.
Function onlyword (strng)
Set Re = new Regexp
Re. ignorecase = true
Re. Global = true
Re. pattern = "(<) (. [^ <] *) (src =) ('|" & CHR (34) & "| )? (. [^ '|/S | "& CHR (34) &"] *) (/.) (JPG | GIF | PNG | BMP | JPEG) ('| "& CHR (34) &" |/S |> )(. [^>] *) (>) "'setting mode.
Onlyword = Re. Replace (strng ,"")
Set Re = nothing
End Function