471,089 Members | 1,273 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

help hiding image paths



anyone know a useful way of hiding image paths so images on my site cant be
directly linked to?
ive seen sites that use <img src="image.asp?/moo/fred/image01.jpg"> (where
the path starts from www.domain.com/secretfolder/moo/fred/image01.jpg) but
dont know how to set this up

BTW am on a shared host so dont have the use of base level administration if
it makes any difference?

anyone help me?
mark


Jul 22 '05 #1
10 2795
"mark | r" <tr*********@hotmail.com> wrote in message
news:42***********************@news.dial.pipex.com ...
:
: anyone know a useful way of hiding image paths so images on my site cant
be
: directly linked to?
: ive seen sites that use <img src="image.asp?/moo/fred/image01.jpg"> (where
: the path starts from www.domain.com/secretfolder/moo/fred/image01.jpg) but
: dont know how to set this up
:
: BTW am on a shared host so dont have the use of base level administration
if
: it makes any difference?

You would actually put the folder outside the web root, not beneath it.

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True

Function ReadBinaryFile(FileName)
Const adTypeBinary = 1
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeBinary
BinaryStream.Open
BinaryStream.LoadFromFile FileName
ReadBinaryFile = BinaryStream.Read
End Function

Const strPath = "c:\images\"
dim path, gifdata, file
file = "logo.gif"
path = strPath & file
gifdata = ReadBinaryFile(path)
Response.ContentType = "image/gif"
Response.Buffer = True
Response.Clear
Response.BinaryWrite gifdata
Response.Flush
%>

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #2

"Roland Hall" <nobody@nowhere> wrote in message
news:OQ**************@TK2MSFTNGP14.phx.gbl...


"mark | r" <tr*********@hotmail.com> wrote in message
news:42***********************@news.dial.pipex.com ...
:
: anyone know a useful way of hiding image paths so images on my site cant
be
: directly linked to?
: ive seen sites that use <img src="image.asp?/moo/fred/image01.jpg"> (where : the path starts from www.domain.com/secretfolder/moo/fred/image01.jpg) but : dont know how to set this up
:
: BTW am on a shared host so dont have the use of base level administration if
: it makes any difference?

You would actually put the folder outside the web root, not beneath it.

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True

Function ReadBinaryFile(FileName)
Const adTypeBinary = 1
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeBinary
BinaryStream.Open
BinaryStream.LoadFromFile FileName
ReadBinaryFile = BinaryStream.Read
End Function

Const strPath = "c:\images\"
dim path, gifdata, file
file = "logo.gif"
path = strPath & file
gifdata = ReadBinaryFile(path)
Response.ContentType = "image/gif"
Response.Buffer = True
Response.Clear
Response.BinaryWrite gifdata
Response.Flush
%>

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library - http://msdn.microsoft.com/library/default.asp


is that the image.asp file? and i guess i should use response.queystring to
get the filename and set the types to jpeg etc?

Mark


Jul 22 '05 #3
"mark | r" wrote in message
news:42***********************@news.dial.pipex.com ...
: "Roland Hall" <nobody@nowhere> wrote in message
: news:OQ**************@TK2MSFTNGP14.phx.gbl...
: >
: >
: > "mark | r" <tr*********@hotmail.com> wrote in message
: > news:42***********************@news.dial.pipex.com ...
: > :
: > : anyone know a useful way of hiding image paths so images on my site
cant
: > be
: > : directly linked to?
: > : ive seen sites that use <img src="image.asp?/moo/fred/image01.jpg">
: (where
: > : the path starts from www.domain.com/secretfolder/moo/fred/image01.jpg)
: but
: > : dont know how to set this up
: > :
: > : BTW am on a shared host so dont have the use of base level
: administration
: > if
: > : it makes any difference?
: >
: > You would actually put the folder outside the web root, not beneath it.
: >
: > <%@ Language=VBScript %>
: > <%
: > Option Explicit
: > Response.Buffer = True
: >
: > Function ReadBinaryFile(FileName)
: > Const adTypeBinary = 1
: > Dim BinaryStream
: > Set BinaryStream = CreateObject("ADODB.Stream")
: > BinaryStream.Type = adTypeBinary
: > BinaryStream.Open
: > BinaryStream.LoadFromFile FileName
: > ReadBinaryFile = BinaryStream.Read
: > End Function
: >
: > Const strPath = "c:\images\"
: > dim path, gifdata, file
: > file = "logo.gif"
: > path = strPath & file
: > gifdata = ReadBinaryFile(path)
: > Response.ContentType = "image/gif"
: > Response.Buffer = True
: > Response.Clear
: > Response.BinaryWrite gifdata
: > Response.Flush
: > %>
: >
:
: is that the image.asp file? and i guess i should use response.queystring
to
: get the filename and set the types to jpeg etc?

If it's a link and you're passing the name on the URL, yes, use
Request.QueryString. The ContentType would need to be the appropriate MIME
type for the file being read.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #4
And here's a related link:

Serving Dynamic Images from Static Web Pages - 5/24/2000
http://www.4guysfromrolla.com/webtech/052400-1.shtml

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Jul 22 '05 #5
http://www.aspfaq.com/2276

anyone know a useful way of hiding image paths so images on my site cant be directly linked to?

Jul 22 '05 #6
Where I want the image displayed I put <img src="_invoiceImage.asp">

in _invoiceImage.asp I have:

<%
iImg = session("uid")
Set ctrl = server.createobject("GflAx.GflAx")
const AX_JPEG = 3
With ctrl
.enablelzw= True
.LoadBitmap server.MapPath("/invoiceimages/" & iImg & ".jpg")

iMaxW = 320
iMaxH = 130
if .width > iMaxW or .height > iMaxH then
if .width > .height then
iRatio = iMaxW / .width
else
iRatio = iMaxH / .height
end if
iImgW = .width * iRatio
iImgH = .height * iRatio
.Resize iImgW, iImgH
end if
.Saveformat = AX_JPEG

response.contenttype = "image/jpeg"
response.binarywrite .SendBinary
end with

set ctrl=nothing

%>

This finds the image based on the uid stored inthe session object and does
some resizing but I am sure you can modify this to your needs.

Duane.

"mark | r" <tr*********@hotmail.com> wrote in message
news:42***********************@news.dial.pipex.com ...


anyone know a useful way of hiding image paths so images on my site cant
be
directly linked to?
ive seen sites that use <img src="image.asp?/moo/fred/image01.jpg"> (where
the path starts from www.domain.com/secretfolder/moo/fred/image01.jpg) but
dont know how to set this up

BTW am on a shared host so dont have the use of base level administration
if
it makes any difference?

anyone help me?
mark

Jul 22 '05 #7
> Set ctrl = server.createobject("GflAx.GflAx")

What DLL is this? Where did you get it?
Jul 22 '05 #8
Aaron Bertrand [SQL Server MVP] wrote:
Set ctrl = server.createobject("GflAx.GflAx")

What DLL is this? Where did you get it?

Sorry, I should have said...It's a free dll, http://www.xnview.com/ or
http://perso.wanadoo.fr/pierre.g/xnview/engfl.html
Jul 22 '05 #9
Aaron Bertrand [SQL Server MVP] wrote:
Set ctrl = server.createobject("GflAx.GflAx")

What DLL is this? Where did you get it?

Sorry, I should have said...It's a free dll, http://www.xnview.com/ or
http://perso.wanadoo.fr/pierre.g/xnview/engfl.html
Jul 22 '05 #10
"Duane Jackson" wrote in message news:42**************@keyone.co.uk...
: Aaron Bertrand [SQL Server MVP] wrote:
: >>Set ctrl = server.createobject("GflAx.GflAx")
: >
: > What DLL is this? Where did you get it?
: >
: Sorry, I should have said...It's a free dll, http://www.xnview.com/ or
: http://perso.wanadoo.fr/pierre.g/xnview/engfl.html

It probably won't do you much good if your site is hosted.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by DaveB | last post: by
3 posts views Thread by William Starr Moake | last post: by
3 posts views Thread by Bill Brother | last post: by
6 posts views Thread by bissatch | last post: by
4 posts views Thread by web_design | last post: by
7 posts views Thread by smerf | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.