This function can read all the image paths in the HTML code, so that you can save the image paths obtained in batches to the database, add watermarks to images in batches, or scale down images in batches, it is very convenient to operate as needed.
If the path starts with http: //, you can use the remote file download function to download the file. In this way, remote images or files are downloaded in batches.
Function oflink_lcasetag (imgstrng)
'Extraordinary design original 361du.net
'Convert the tags in the HTML code of the content to lowercase.
Dim RegEx, match, matches 'to create a variable.
Set RegEx = new Regexp 'to create a regular expression.
RegEx. pattern = "<. +? \> "'Setting mode.
RegEx. ignorecase = true' specifies whether the characters are case sensitive.
RegEx. Global = true' to set global availability.
Set matches = RegEx. Execute (imgstrng) 'to execute the search.
Imgstrng = imgstrng
For each match in matches 'traverses the matching set.
Imgstrng = Replace (imgstrng, match. Value, lcase (match. Value ))
Next
Oflink_lcasetag = imgstrng
End Function
Function ofink_getsrc (strng)
'Extraordinary design original 361du.net
'Batch retrieve image paths
Strng = oflink_lcasetag (strng)
Dim RegEx, match, matches, values, if_add' create a variable.
Set RegEx = new Regexp 'to create a regular expression.
RegEx. pattern = "src \ =. +? \. (GIF | JPG | JPEG | jpe | PNG )"
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.
If_add = 0
For each match in matches 'traverses the matching set.
Values = Values & Match. Value & "|"
If_add = 1
Next
Values = Replace (values, "src = ""","")
Values = Replace (values, "src = '","")
Values = Replace (values, "src = ","")
If if_add = 1 then values = left (values, Len (values)-1)
Ofink_getsrc = values
End Function
How to use this function: imglist = ofink_getsrc (content)
Content can be the content of multiple images in the editing box.
The imglist results are separated by "|", for example, 1.jpg | 2.jpg | 3.jpg.
After this result is obtained, you can use the split function to obtain a single image. You just need to perform any operations on the image.