<% Option Explicit Response.expires = 0 Response.expiresabsolute = now() -1 Response.CacheControl = "no-cache" Const MAX_BUFFER_SIZE = 2000000 On Error Resume Next Dim imgURL, fileExt, r_start, r_end, imgPath imgURL = Trim(Request("imgURL")) r_start = CLng(Request("start")) r_end = CLng(Request("end")) fileExt = LCase( Right( imgURL, Len(imgURL)-InstrRev(imgURL,".")) ) If Err.Number<>0 Or r_start>r_end Or (fileExt<>"jpg") Or (r_end-r_start)>MAX_BUFFER_SIZE Then Response.End End If Dim imgAbsURL imgAbsURL = "http://" & Request.ServerVariables("HTTP_HOST") & imgURL Dim oReq Set oReq = CreateObject("Microsoft.XMLHTTP") Call oReq.open("GET", imgAbsURL, False) Call oReq.setRequestHeader("Range", "bytes="&r_start&"-"&r_end) Call oReq.send() Response.AddHeader "Pragma", "no-cache" Response.AddHeader "Content-Transfer-Encoding", "binary" Response.AddHeader "Content-Length", "" & (r_end-r_start) Response.BinaryWrite oReq.ResponseBody Set oReq = Nothing Response.End On Error Goto 0 %>