BVB Source Codes

Jie Yang v0.6.3 article system Show SaveRemoteImg.asp Source code

Return Download Jie Yang v0.6.3 article system: download SaveRemoteImg.asp Source code - Download Jie Yang v0.6.3 article system Source code - Type:.asp
  1. <!--#include file="../admin_check.asp" -->
  2. <%
  3. '远程图片保存类型
  4. Const sFileExt="jpg|gif|bmp|png"
  5. '*****************************************************
  6. '函数功能:替换字符串中的远程文件为本地文件并保存远程文件
  7. '参数:
  8. '      sHTML         : 要替换的字符串
  9. '      sSaveFilePath : 保存文件的路径
  10. '      sIsAspJpeg    : 是否给图片加水印,1加水印,0不加  
  11. '*****************************************************
  12. Function ReplaceRemoteUrl(sHTML,sSaveFilePath,sIsAspJpeg)
  13.      Dim s_Content
  14.      s_Content = sHTML
  15.      If IsObjInstalled("Microsoft.XMLHTTP") = False then
  16.          ReplaceRemoteUrl = s_Content
  17.          Exit Function
  18.      End If    
  19.      Dim re,RemoteFile,RemoteFileurl,SaveFileName,SaveFileType,arrSaveFileNameS,arrSaveFileName,ranNum,dtNow
  20.      Set re = new RegExp
  21.      re.IgnoreCase = True
  22.      re.Global = True
  23.      re.Pattern = "((http|https|ftp|rtsp|mms):(\/\/|\\\\){1}((\w)+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})(\S*\/)((\S)+[.]{1}(" & sFileExt & ")))"
  24.      Set RemoteFile = re.Execute(s_Content)
  25.      For Each RemoteFileurl in RemoteFile
  26.                  arrSaveFileName = Split(RemoteFileurl,".")
  27.                  SaveFileType=arrSaveFileName(UBound(arrSaveFileName))
  28.                  dtNow=Now()
  29.                  randomize
  30.                  ranNum=int(90000*rnd)+10000
  31.                  arrSaveFileName=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum&"."&SaveFileType
  32.          SaveFileName = sSaveFilePath & arrSaveFileName
  33.          Call SaveRemoteFile(SaveFileName,RemoteFileurl)
  34.                  
  35.                  '图远程图片加水印
  36.                  If IsAspJpeg=1 and sIsAspJpeg=1 then
  37.                         Call PicAspJpeg(SaveFileName)
  38.                  End If
  39.  
  40.          s_Content = Replace(s_Content,RemoteFileurl,SaveFileName)
  41.      Next
  42.      ReplaceRemoteUrl = s_Content
  43. End Function
  44.  
  45. '*********************************************
  46. '函数功能:保存远程的文件到本地
  47. '参 数:
  48. '       s_LocalFileName:本地文件名
  49. '       s_RemoteFileUrl:远程文件URL
  50. '返回值:
  51. 'True   成功
  52. 'False  失败
  53. '*********************************************
  54. Sub SaveRemoteFile(s_LocalFileName,s_RemoteFileUrl)
  55.      Dim Ads, Retrieval, GetRemoteData
  56.      On Error Resume Next
  57.      Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
  58.      With Retrieval
  59.          .Open "Get",s_RemoteFileUrl,False,"",""
  60.          .Send
  61.          GetRemoteData = .ResponseBody
  62.      End With
  63.      Set Retrieval = Nothing
  64.      Set Ads = Server.CreateObject("Adodb.Stream")
  65.      With Ads
  66.          .Type = 1
  67.          .Open
  68.          .Write GetRemoteData
  69.          .SaveToFile Server.MapPath(s_LocalFileName),2
  70.          .Cancel()
  71.          .Close()
  72.      End With
  73.      Set Ads=nothing
  74. End Sub
  75. %>
downloadSaveRemoteImg.asp Source code - Download Jie Yang v0.6.3 article system Source code
Related Source Codes/Software:
Jilin classification information release system v5.0 trial version - A ready-made classifieds site publishing system, h... 2016-09-21
Linyi CMS v6.5 market classification information - A. supply and demand information function: informa... 2016-09-21
Tesco discount net SQL version - And presentations, faster. 2016-09-21
- electronic enterprise website management system In a fully functional version - Super suitable for enterprise agents build a corpo... 2016-09-21
Rio mesh network hard disk system v3.0 - System functions: 1, increase the progress of Asp... 2016-09-21
Classified information network business in suzhou - Overall module: classification of supply and deman... 2016-09-21
NPOINT virtual host v1.7.0 formal version management system - The system main function is introduced 2016-09-21
IDC sales web site - Beautiful IDC sales web site source code 2016-09-21
Oo 126 CMS movie site system - This procedure ASP + ACC/ASP + SQL, using new kern... 2016-09-21
Pcook CMS bubble guest v3.0 SDCMS version - Developed by Asp+Access, and meet the needs of sma... 2016-09-21
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top