<% Function ReadByteArray(strFileName) Const adTypeBinary = 1 Dim bin Set bin = CreateObject("ADODB.Stream") bin.Type = adTypeBinary bin.Open On Error Resume Next bin.LoadFromFile strFileName ReadByteArray = bin.Read End Function function cart1(xxxxx) cartella=xxxxx while len(cartella)<3 cartella="0" & cartella wend cart1=right(cartella,3) end function function getEventoThumb (imgSrcPath, imgName, outFolder) jpgImageName = Replace(imgName, ",", "") jpgImageName = Replace(jpgImageName, " ", "-") sThumbFile = outFolder & jpgImageName sThumbFullPath = Server.MapPath(sThumbFile) set fs=Server.CreateObject("Scripting.FileSystemObject") if fs.FileExists(sThumbFullPath) then getEventoThumb = outFolder & jpgImageName else sImageFullPath = Server.MapPath(imgSrcPath & imgName) Set Image = Server.CreateObject("AspImage.Image") mettifoto=image.loadimage(sImageFullPath) w = 70 h = 70 image.PadSize=0 image.imageformat=1 x0 = (image.maxx - w)/2 y0 = (image.maxy - h)/2 image.CropImage x0, y0, w, h image.FileName = sThumbFullPath if Image.SaveImage Then erroresmall = 0 Else erroresmall = 5 set image=nothing getEventoThumb = outFolder & jpgImageName end if set fs=nothing end function idEvento = Request("ide") imgThumbName = "/newsletter/img/default_event_image.jpg" If Len(idEvento) > 0 And IsNumeric(idEvento) Then idEvento = Int(idEvento) ' anti injection Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open Application("OLEDB_CONNECTION") sql_corr = "SELECT * FROM eventiv2 WHERE idEvento = '" & idEvento &"' " Set rs_corr = Conn.Execute(sql_corr) if Not rs_corr.Eof then acId = rs_corr("Idevento") evFotoName ="rev"& acId & "(" & rs_corr("versfotoevento") & ").jpg" evFotoFolder = "/profilo/imgpost/rev/"& cart1(acId)& "/" evSrcFotoPath = evFotoFolder & evFotoName set fsGlobal=Server.CreateObject("Scripting.FileSystemObject") if fsGlobal.FileExists(Server.MapPath(evSrcFotoPath)) then imgThumbName = getEventoThumb (evFotoFolder, evFotoName, "/ns_foto/newsletter/eventi/") end if set fsGlobal=nothing end if Conn.Close Set Conn = Nothing End If imgName = Server.MapPath(imgThumbName) 'Response.write imgName 'response.end Response.expires = -1000 Response.ContentType = "image/jpg" thefile=ReadByteArray(imgName) On Error Resume Next response.binarywrite thefile response.flush %>