<% ' Copyright 2005-2006 BeachBum Software ' all rights reserved ' one purchased copy allowed for use on one server at one time. ' email support@beachbumsoftware.com for licensing information. ResourceURL = "" ' include final / Col1 = request.querystring("B") Col2 = request.querystring("F") Resource = request.querystring("L") LogoFile = server.mapPath(ResourceURL & Resource) Set objFSO = CreateObject("Scripting.FileSystemObject") ' First, we get the filesize Set objFTemp = objFSO.GetFile(LogoFile) lngSize = objFTemp.Size Set objFTemp = Nothing fsoForReading = 1 Set objTextStream = objFSO.OpenTextFile(LogoFile, fsoForReading) set objFSP = Nothing GifFile = GetBytes(LogoFile,0,-1) Width = lngConvert(mid(GifFile,7,2)) Height = lngConvert(mid(GifFile,9,2)) Depth = 2 ^ ((asc(mid(GifFile,11,1)) and 7) +1) GifTemp = left(gifFile,13) for x=14 to ((Depth-1) * 3) + 14 step 3 Ro = pad(hex(asc(mid(GifFile, x, 1)))) Go = pad(hex(asc(mid(GifFile, x+1, 1)))) Bo = pad(hex(asc(mid(giffile, x+2, 1)))) Ocol = Ro & Go & Bo Ncol = Meld(Col2,Col1,Ocol) Rn = Chr(cInt("&h" & Left(Ncol,2))) Gn = Chr(cInt("&h" & Mid(Ncol,3,2))) Bn = Chr(cInt("&h" & Right(Ncol,2))) GifTemp = GifTemp & Rn & Gn & Bn next GifTail = mid(GifFile,x,lngSize) GifFile = GifTemp & GifTail Response.ContentType = "image/gif" MaxIndex = Len(GifFile) For Index = 1 To MaxIndex Response.BinaryWrite(ChrB("&h" & hex(asc(Midb(GifFile, ((Index - 1) * 2) + 1, 2))))) Next function GetBytes(flnm, offset, bytes) Dim objFSO, objFTemp, objTextStream, lngSize on error resume next Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFTemp = objFSO.GetFile(flnm) lngSize = objFTemp.Size Set objFTemp = Nothing fsoForReading = 1 Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading) if offset > 0 then strBuff = objTextStream.Read(offset - 1) end if if bytes = -1 then GetBytes = objTextStream.Read(lngSize) else GetBytes = objTextStream.Read(bytes) end if objTextStream.Close Set objTextStream = Nothing Set objFSO = Nothing end function function lngConvert(strTemp) lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256))) end function function lngConvert2(strTemp) lngConvert2 = clng(asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256))) end function function gifSpec(flnm, width, height, depth, strImageType) dim strType strType = GetBytes(flnm, 0, 3) if strType = strGIF then strImageType = "GIF" Width = lngConvert(GetBytes(flnm,7,2)) Height = lngConvert(GetBytes(flnm, 9, 2)) Depth = int(2 ^ ((asc(GetBytes(flnm, 11, 1)) and 7) + 1)) gifSpec = True else strImageType = "Unknown" Width = 0 Height = 0 Depth = 0 gifSpec = False end if end function Function Pad(St) ' Pad the Length of the Dx Codes to 2 ' If the length of the Str is less than the variable 'length' If Len(St) < 2 Then mystring = "0" & St Else mystring = St End If Pad = mystring End Function function Meld(Col1,Col2,Br) R = CInt("&h" & Left(Col1, 2)) - ( (CInt("&h" & Left(Col1, 2)) - CInt("&h" & Left(Col2, 2))) * (cInt("&h" & left(Br,2))/255) ) 'R G = CInt("&h" & Mid(Col1, 3, 2)) - ( (CInt("&h" & Mid(Col1, 3, 2)) - CInt("&h" & Mid(Col2, 3, 2))) * (cInt("&h" & mid(Br,3,2))/255) ) 'G B = CInt("&h" & Right(Col1, 2)) - ( (CInt("&h" & Right(Col1, 2)) - CInt("&h" & Right(Col2, 2))) * (cInt("&h" & right(Br,2))/255) ) 'B Meld = Right("0" & Hex(R), 2) & _ Right("0" & Hex(G), 2) & _ Right("0" & Hex(B), 2) end function ' Copyright 2005-2006 BeachBum Software ' all rights reserved ' one purchased copy allowed for use on one server at one time. ' email support@beachbumsoftware.com for licensing information. %>