Hiding a hyperlink!

  • Thread starter Thread starter Srinivas Chundi
  • Start date Start date
S

Srinivas Chundi

Using VB6, I have created an excel spreadsheet. Some cells contain a
hyperlink to TIF image files on a specific server within the LAN. When the
user clicks on any one of these cells, it launches a copy of Imaging
software and displays the image the hyperlink is pointing to.

Is it possible to let the users view the images, like they are currently
doing, without giving them direct read access to the specific location where
the image files are located? I need to do this to ensure that the users do
not view/access the images by any means other than clicking on the
hyperlink. Also, the location of the images should be hidden from them and
they should not be able to edit or copy/paste the hyperlink to a different
software, such as word. In essance, the users should not know where the
images are actually located and they should not be able to get to them by
any other means, say using windows explorer or word.

It is really important that I accomplish something as close to this as
possible.
Any help is greatly appreciated.
Thanks
-- M
 
If you lock the cell (default) in Format=>Cells, protection tab and also
select hidden and then protect the worksheet under
Tools=>Protection=>Protect sheet with a password, doesn't that do what you
want.

This certainly isn't foolproof as password crackers are easy to come by, but
does provide some security.

Obviously, you need to specify a display value, not have it default to the
fully qualified path to the file.
 
I have explored this. The user can select the cell containing the hyperlink,
copy it to the clipboard (Ctrl+C) and paste it in MS word. From here he can
right click on the link to edit or view it. The protection is no longer
available once the user goes out of the Excel spreadsheet. Unless I am
missing something.
-M
 
Hi Srinivas,

I think the only way you're going to be able to "hide" the real location of
the images is by adding a second layer to the process. For example, you
could store the images in a database. Alternatively, you could create an
ASP document that streams the binary output of the image when a user hits
it. For example, you could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from the
filesystem, and stream it back to Excel. This would hide the original
location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Jake,
I was unable to access the link you posted. Can you please check that for
me.
Thanks
-M



Jake Marx said:
Hi Srinivas,

I think the only way you're going to be able to "hide" the real location of
the images is by adding a second layer to the process. For example, you
could store the images in a database. Alternatively, you could create an
ASP document that streams the binary output of the image when a user hits
it. For example, you could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from the
filesystem, and stream it back to Excel. This would hide the original
location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS word.
From here he can right click on the link to edit or view it. The
protection is no longer available once the user goes out of the Excel
spreadsheet. Unless I am missing something.
-M
 
Hi Jake,
Sorry for the blooper. Please ignore my prev posting.
My apologies.
-M
Jake Marx said:
Hi Srinivas,

I think the only way you're going to be able to "hide" the real location of
the images is by adding a second layer to the process. For example, you
could store the images in a database. Alternatively, you could create an
ASP document that streams the binary output of the image when a user hits
it. For example, you could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from the
filesystem, and stream it back to Excel. This would hide the original
location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS word.
From here he can right click on the link to edit or view it. The
protection is no longer available once the user goes out of the Excel
spreadsheet. Unless I am missing something.
-M
 
Jake,
Since I could not get our operations to let me use a web server, my original
idea was to create a dll that could be installed on users machines. This dll
could have functions that can copy the images from the server to a temporary
location on the users' machine. But later, I realized that the number of
users could be fairly big. So I am in the process of convincing them to use
the web server, in the manner you describe.

Can you please point me to an example or some helpful links.
Thanks for your help.
--M



Jake Marx said:
Hi Srinivas,

I think the only way you're going to be able to "hide" the real location of
the images is by adding a second layer to the process. For example, you
could store the images in a database. Alternatively, you could create an
ASP document that streams the binary output of the image when a user hits
it. For example, you could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from the
filesystem, and stream it back to Excel. This would hide the original
location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS word.
From here he can right click on the link to edit or view it. The
protection is no longer available once the user goes out of the Excel
spreadsheet. Unless I am missing something.
-M
 
Hi Srinivas,

Here's some sample ASP code that should get you started:

<%@ Language=VBScript EnableSessionState=False%>
<%Option Explicit%>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=0

Dim objStream, sImgName

sImgName=Request.QueryString("imageName")

If Len(sImgName) Then
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile "C:\images\" & sImgName
Response.ContentType = "image/jpeg"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Else
Response.Write "Invalid image name."
End If
%>

This code assumes that your images are placed in C:\images\ (on the web
server's hard drive). Excel (or wherever you place your hyperlinks) should
link to http://servername/folder/filename.asp?imageName=image1.jpg or
similar. Notice that the actual filename of the image (without the path) is
passed in via the imageName argument in the querystring. You could do this
differently - i.e., create a mapping of codes to filenames, which would add
a bit more complexity. But it shouldn't be too difficult.

Unless the users have rights to view the source of the ASP document (can
only be done through the file system, and they shouldn't have rights to
files on the server anyway), they will never know where the images came
from.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
Jake,
Since I could not get our operations to let me use a web server, my
original idea was to create a dll that could be installed on users
machines. This dll could have functions that can copy the images from
the server to a temporary location on the users' machine. But later,
I realized that the number of users could be fairly big. So I am in
the process of convincing them to use the web server, in the manner
you describe.

Can you please point me to an example or some helpful links.
Thanks for your help.
--M



Jake Marx said:
Hi Srinivas,

I think the only way you're going to be able to "hide" the real
location of the images is by adding a second layer to the process.
For example, you could store the images in a database.
Alternatively, you could create an ASP document that streams the
binary output of the image when a user hits it. For example, you
could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from
the filesystem, and stream it back to Excel. This would hide the
original location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS
word. From here he can right click on the link to edit or view it.
The protection is no longer available once the user goes out of the
Excel spreadsheet. Unless I am missing something.
-M

If you lock the cell (default) in Format=>Cells, protection tab and
also select hidden and then protect the worksheet under
Tools=>Protection=>Protect sheet with a password, doesn't that do
what you want.

This certainly isn't foolproof as password crackers are easy to
come by, but does provide some security.

Obviously, you need to specify a display value, not have it default
to the fully qualified path to the file.

--
Regards,
Tom Ogilvy



Using VB6, I have created an excel spreadsheet. Some cells
contain a hyperlink to TIF image files on a specific server
within the LAN. When the user clicks on any one of these cells,
it launches a copy of Imaging software and displays the image the
hyperlink is pointing to.

Is it possible to let the users view the images, like they are
currently doing, without giving them direct read access to the
specific location where the image files are located? I need to do
this to ensure that the users do not view/access the images by any
means other than clicking on the hyperlink. Also, the location of
the images should be hidden from them and they should not be able
to edit or copy/paste the hyperlink to a different software, such
as word. In essance, the users should not know where the images
are actually located and they should not be able to get to them
by any other means, say using windows explorer or word.

It is really important that I accomplish something as close to
this as possible.
Any help is greatly appreciated.
Thanks
-- M
 
Your correct. If you are going to have code in your workbook, then why not
simulate a hyperlink and use the the selectionchange event to fetch the
picture.
 
Jake,
Thanks a bunch for the code.
I followed the example you gave. It should have worked, except for one thing
I ignored to mention.
The image files I have are .tif files. (I did not realise this could make a
difference). When I ran the asp page, instead of displaying the image in the
browser,
it prompted me if to select open or save. In the place where the image is
supposed to be displayed, I see a lot of strange looking text. My guess is I
do not have the right Content type. I have tried "application/tif" and
"image/tif". Neither worked.

In our installation we have something called "Imaging for Windows Preview"
that is launched when we double click on a .tif file. Is there any way to
force the browser to launch this program and display the image in it?
Thanks for your help
--M



Jake Marx said:
Hi Srinivas,

Here's some sample ASP code that should get you started:

<%@ Language=VBScript EnableSessionState=False%>
<%Option Explicit%>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=0

Dim objStream, sImgName

sImgName=Request.QueryString("imageName")

If Len(sImgName) Then
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile "C:\images\" & sImgName
Response.ContentType = "image/jpeg"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Else
Response.Write "Invalid image name."
End If
%>

This code assumes that your images are placed in C:\images\ (on the web
server's hard drive). Excel (or wherever you place your hyperlinks) should
link to http://servername/folder/filename.asp?imageName=image1.jpg or
similar. Notice that the actual filename of the image (without the path) is
passed in via the imageName argument in the querystring. You could do this
differently - i.e., create a mapping of codes to filenames, which would add
a bit more complexity. But it shouldn't be too difficult.

Unless the users have rights to view the source of the ASP document (can
only be done through the file system, and they shouldn't have rights to
files on the server anyway), they will never know where the images came
from.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
Jake,
Since I could not get our operations to let me use a web server, my
original idea was to create a dll that could be installed on users
machines. This dll could have functions that can copy the images from
the server to a temporary location on the users' machine. But later,
I realized that the number of users could be fairly big. So I am in
the process of convincing them to use the web server, in the manner
you describe.

Can you please point me to an example or some helpful links.
Thanks for your help.
--M



Jake Marx said:
Hi Srinivas,

I think the only way you're going to be able to "hide" the real
location of the images is by adding a second layer to the process.
For example, you could store the images in a database.
Alternatively, you could create an ASP document that streams the
binary output of the image when a user hits it. For example, you
could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from
the filesystem, and stream it back to Excel. This would hide the
original location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas Chundi wrote:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS
word. From here he can right click on the link to edit or view it.
The protection is no longer available once the user goes out of the
Excel spreadsheet. Unless I am missing something.
-M

If you lock the cell (default) in Format=>Cells, protection tab and
also select hidden and then protect the worksheet under
Tools=>Protection=>Protect sheet with a password, doesn't that do
what you want.

This certainly isn't foolproof as password crackers are easy to
come by, but does provide some security.

Obviously, you need to specify a display value, not have it default
to the fully qualified path to the file.

--
Regards,
Tom Ogilvy



Using VB6, I have created an excel spreadsheet. Some cells
contain a hyperlink to TIF image files on a specific server
within the LAN. When the user clicks on any one of these cells,
it launches a copy of Imaging software and displays the image the
hyperlink is pointing to.

Is it possible to let the users view the images, like they are
currently doing, without giving them direct read access to the
specific location where the image files are located? I need to do
this to ensure that the users do not view/access the images by any
means other than clicking on the hyperlink. Also, the location of
the images should be hidden from them and they should not be able
to edit or copy/paste the hyperlink to a different software, such
as word. In essance, the users should not know where the images
are actually located and they should not be able to get to them
by any other means, say using windows explorer or word.

It is really important that I accomplish something as close to
this as possible.
Any help is greatly appreciated.
Thanks
-- M
 
Hi Srinivas,
Tif files are not supported by IE, but they are viewable in Excel.

Have you considered using buttons on your sheet?
It should be easy to redirect to a sub passing the button# for a select
case.
The point being, you can password protect the module preventing the user
from seeing the code/hyperlink.
There is no commandbutton collection in VBA but it would be mostly
copy&paste/edit.

'worksheet module
Private Sub CommandButton1_Click()
Var = 1
GetPicture Var
End Sub

'general module
sub getpicture(Var as integer)
select case Var
case 1
application.hyperlink.follow(yourhyperlink)
....





--

John

johnf202 at hotmail dot com


Srinivas Chundi said:
Jake,
Thanks a bunch for the code.
I followed the example you gave. It should have worked, except for one thing
I ignored to mention.
The image files I have are .tif files. (I did not realise this could make a
difference). When I ran the asp page, instead of displaying the image in the
browser,
it prompted me if to select open or save. In the place where the image is
supposed to be displayed, I see a lot of strange looking text. My guess is I
do not have the right Content type. I have tried "application/tif" and
"image/tif". Neither worked.

In our installation we have something called "Imaging for Windows Preview"
that is launched when we double click on a .tif file. Is there any way to
force the browser to launch this program and display the image in it?
Thanks for your help
--M



Jake Marx said:
Hi Srinivas,

Here's some sample ASP code that should get you started:

<%@ Language=VBScript EnableSessionState=False%>
<%Option Explicit%>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=0

Dim objStream, sImgName

sImgName=Request.QueryString("imageName")

If Len(sImgName) Then
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile "C:\images\" & sImgName
Response.ContentType = "image/jpeg"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Else
Response.Write "Invalid image name."
End If
%>

This code assumes that your images are placed in C:\images\ (on the web
server's hard drive). Excel (or wherever you place your hyperlinks) should
link to http://servername/folder/filename.asp?imageName=image1.jpg or
similar. Notice that the actual filename of the image (without the
path)
is
passed in via the imageName argument in the querystring. You could do this
differently - i.e., create a mapping of codes to filenames, which would add
a bit more complexity. But it shouldn't be too difficult.

Unless the users have rights to view the source of the ASP document (can
only be done through the file system, and they shouldn't have rights to
files on the server anyway), they will never know where the images came
from.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
Jake,
Since I could not get our operations to let me use a web server, my
original idea was to create a dll that could be installed on users
machines. This dll could have functions that can copy the images from
the server to a temporary location on the users' machine. But later,
I realized that the number of users could be fairly big. So I am in
the process of convincing them to use the web server, in the manner
you describe.

Can you please point me to an example or some helpful links.
Thanks for your help.
--M



Hi Srinivas,

I think the only way you're going to be able to "hide" the real
location of the images is by adding a second layer to the process.
For example, you could store the images in a database.
Alternatively, you could create an ASP document that streams the
binary output of the image when a user hits it. For example, you
could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from
the filesystem, and stream it back to Excel. This would hide the
original location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas Chundi wrote:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS
word. From here he can right click on the link to edit or view it.
The protection is no longer available once the user goes out of the
Excel spreadsheet. Unless I am missing something.
-M

If you lock the cell (default) in Format=>Cells, protection tab and
also select hidden and then protect the worksheet under
Tools=>Protection=>Protect sheet with a password, doesn't that do
what you want.

This certainly isn't foolproof as password crackers are easy to
come by, but does provide some security.

Obviously, you need to specify a display value, not have it default
to the fully qualified path to the file.

--
Regards,
Tom Ogilvy



Using VB6, I have created an excel spreadsheet. Some cells
contain a hyperlink to TIF image files on a specific server
within the LAN. When the user clicks on any one of these cells,
it launches a copy of Imaging software and displays the image the
hyperlink is pointing to.

Is it possible to let the users view the images, like they are
currently doing, without giving them direct read access to the
specific location where the image files are located? I need to do
this to ensure that the users do not view/access the images by any
means other than clicking on the hyperlink. Also, the location of
the images should be hidden from them and they should not be able
to edit or copy/paste the hyperlink to a different software, such
as word. In essance, the users should not know where the images
are actually located and they should not be able to get to them
by any other means, say using windows explorer or word.

It is really important that I accomplish something as close to
this as possible.
Any help is greatly appreciated.
Thanks
-- M
 
I tried something similar to this. Actually, I tried to read the file from
the server into a temporary folder to which I have established a link in the
excel. Then I use the statement Hyperlinks(1).Follow statement to display
the tif file. This however did not work when the spreadsheet was password
protected. It continuosly and annoyingly popped up a message saying that the
sheet was protected, or the temp file could not be overwritten.

What you are suggesting may be different. Could you elaborate a little more.
Any links, pointers to examples would be helpful.

Thanks
-M
 
Let me try this.
Thanks.
- M
jaf said:
Hi Srinivas,
Tif files are not supported by IE, but they are viewable in Excel.

Have you considered using buttons on your sheet?
It should be easy to redirect to a sub passing the button# for a select
case.
The point being, you can password protect the module preventing the user
from seeing the code/hyperlink.
There is no commandbutton collection in VBA but it would be mostly
copy&paste/edit.

'worksheet module
Private Sub CommandButton1_Click()
Var = 1
GetPicture Var
End Sub

'general module
sub getpicture(Var as integer)
select case Var
case 1
application.hyperlink.follow(yourhyperlink)
...





--

John

johnf202 at hotmail dot com


Srinivas Chundi said:
Jake,
Thanks a bunch for the code.
I followed the example you gave. It should have worked, except for one thing
I ignored to mention.
The image files I have are .tif files. (I did not realise this could
make
a
difference). When I ran the asp page, instead of displaying the image in the
browser,
it prompted me if to select open or save. In the place where the image is
supposed to be displayed, I see a lot of strange looking text. My guess
is
I
do not have the right Content type. I have tried "application/tif" and
"image/tif". Neither worked.

In our installation we have something called "Imaging for Windows Preview"
that is launched when we double click on a .tif file. Is there any way to
force the browser to launch this program and display the image in it?
Thanks for your help
--M



Jake Marx said:
Hi Srinivas,

Here's some sample ASP code that should get you started:

<%@ Language=VBScript EnableSessionState=False%>
<%Option Explicit%>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=0

Dim objStream, sImgName

sImgName=Request.QueryString("imageName")

If Len(sImgName) Then
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile "C:\images\" & sImgName
Response.ContentType = "image/jpeg"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Else
Response.Write "Invalid image name."
End If
%>

This code assumes that your images are placed in C:\images\ (on the web
server's hard drive). Excel (or wherever you place your hyperlinks) should
link to http://servername/folder/filename.asp?imageName=image1.jpg or
similar. Notice that the actual filename of the image (without the
path)
is
passed in via the imageName argument in the querystring. You could do this
differently - i.e., create a mapping of codes to filenames, which
would
add
a bit more complexity. But it shouldn't be too difficult.

Unless the users have rights to view the source of the ASP document (can
only be done through the file system, and they shouldn't have rights to
files on the server anyway), they will never know where the images came
from.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas Chundi wrote:
Jake,
Since I could not get our operations to let me use a web server, my
original idea was to create a dll that could be installed on users
machines. This dll could have functions that can copy the images from
the server to a temporary location on the users' machine. But later,
I realized that the number of users could be fairly big. So I am in
the process of convincing them to use the web server, in the manner
you describe.

Can you please point me to an example or some helpful links.
Thanks for your help.
--M



Hi Srinivas,

I think the only way you're going to be able to "hide" the real
location of the images is by adding a second layer to the process.
For example, you could store the images in a database.
Alternatively, you could create an ASP document that streams the
binary output of the image when a user hits it. For example, you
could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from
the filesystem, and stream it back to Excel. This would hide the
original location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas Chundi wrote:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS
word. From here he can right click on the link to edit or view it.
The protection is no longer available once the user goes out of the
Excel spreadsheet. Unless I am missing something.
-M

If you lock the cell (default) in Format=>Cells, protection tab and
also select hidden and then protect the worksheet under
Tools=>Protection=>Protect sheet with a password, doesn't that do
what you want.

This certainly isn't foolproof as password crackers are easy to
come by, but does provide some security.

Obviously, you need to specify a display value, not have it default
to the fully qualified path to the file.

--
Regards,
Tom Ogilvy



Using VB6, I have created an excel spreadsheet. Some cells
contain a hyperlink to TIF image files on a specific server
within the LAN. When the user clicks on any one of these cells,
it launches a copy of Imaging software and displays the image the
hyperlink is pointing to.

Is it possible to let the users view the images, like they are
currently doing, without giving them direct read access to the
specific location where the image files are located? I need to do
this to ensure that the users do not view/access the images by any
means other than clicking on the hyperlink. Also, the location of
the images should be hidden from them and they should not be able
to edit or copy/paste the hyperlink to a different software, such
as word. In essance, the users should not know where the images
are actually located and they should not be able to get to them
by any other means, say using windows explorer or word.

It is really important that I accomplish something as close to
this as possible.
Any help is greatly appreciated.
Thanks
-- M
 
Hi Srinivas,

I think "image/tiff" is the correct content-type for TIFF images.

John is correct - IE won't natively display TIFF images without a plugin or
forcing a download. However, maybe we can simplify things a bit. You could
just serve up the images directly via a URL without using ASP. For example,
you could set up a virtual directory under your website root named "images",
which points to a certain location on the web server that contains the TIFF
images. Then, your code could just hyperlink directly to the image URL
(http://myserver/images/test.tif). The first time the user hits the link,
he/she will have to uncheck the "always ask before opening this type of
file". Each time after that, however, the image should pop up in the user's
default TIFF viewing application.

This doesn't add hide the image names, but it will hide the image location,
and the user will not be able to modify the image on the server.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
Jake,
Thanks a bunch for the code.
I followed the example you gave. It should have worked, except for
one thing I ignored to mention.
The image files I have are .tif files. (I did not realise this could
make a difference). When I ran the asp page, instead of displaying
the image in the browser,
it prompted me if to select open or save. In the place where the
image is supposed to be displayed, I see a lot of strange looking
text. My guess is I do not have the right Content type. I have tried
"application/tif" and "image/tif". Neither worked.

In our installation we have something called "Imaging for Windows
Preview" that is launched when we double click on a .tif file. Is
there any way to force the browser to launch this program and display
the image in it? Thanks for your help
--M



Jake Marx said:
Hi Srinivas,

Here's some sample ASP code that should get you started:

<%@ Language=VBScript EnableSessionState=False%>
<%Option Explicit%>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=0

Dim objStream, sImgName

sImgName=Request.QueryString("imageName")

If Len(sImgName) Then
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile "C:\images\" & sImgName
Response.ContentType = "image/jpeg"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Else
Response.Write "Invalid image name."
End If
%>

This code assumes that your images are placed in C:\images\ (on the
web server's hard drive). Excel (or wherever you place your
hyperlinks) should link to
http://servername/folder/filename.asp?imageName=image1.jpg or
similar. Notice that the actual filename of the image (without the
path) is passed in via the imageName argument in the querystring.
You could do this differently - i.e., create a mapping of codes to
filenames, which would add a bit more complexity. But it shouldn't
be too difficult.

Unless the users have rights to view the source of the ASP document
(can only be done through the file system, and they shouldn't have
rights to files on the server anyway), they will never know where
the images came from.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
Jake,
Since I could not get our operations to let me use a web server, my
original idea was to create a dll that could be installed on users
machines. This dll could have functions that can copy the images
from the server to a temporary location on the users' machine. But
later, I realized that the number of users could be fairly big. So
I am in the process of convincing them to use the web server, in
the manner you describe.

Can you please point me to an example or some helpful links.
Thanks for your help.
--M



Hi Srinivas,

I think the only way you're going to be able to "hide" the real
location of the images is by adding a second layer to the process.
For example, you could store the images in a database.
Alternatively, you could create an ASP document that streams the
binary output of the image when a user hits it. For example, you
could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from
the filesystem, and stream it back to Excel. This would hide the
original location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas Chundi wrote:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS
word. From here he can right click on the link to edit or view it.
The protection is no longer available once the user goes out of
the Excel spreadsheet. Unless I am missing something.
-M

If you lock the cell (default) in Format=>Cells, protection tab
and also select hidden and then protect the worksheet under
Tools=>Protection=>Protect sheet with a password, doesn't that do
what you want.

This certainly isn't foolproof as password crackers are easy to
come by, but does provide some security.

Obviously, you need to specify a display value, not have it
default to the fully qualified path to the file.

--
Regards,
Tom Ogilvy



Using VB6, I have created an excel spreadsheet. Some cells
contain a hyperlink to TIF image files on a specific server
within the LAN. When the user clicks on any one of these cells,
it launches a copy of Imaging software and displays the image
the hyperlink is pointing to.

Is it possible to let the users view the images, like they are
currently doing, without giving them direct read access to the
specific location where the image files are located? I need to
do this to ensure that the users do not view/access the images
by any means other than clicking on the hyperlink. Also, the
location of the images should be hidden from them and they
should not be able to edit or copy/paste the hyperlink to a
different software, such as word. In essance, the users should
not know where the images are actually located and they should
not be able to get to them by any other means, say using
windows explorer or word.

It is really important that I accomplish something as close to
this as possible.
Any help is greatly appreciated.
Thanks
-- M
 
Hi Jake,
The approach you suggest seems to be the easiest route to take for what I
want to accomplish. The only hurdle I could face is from our network
administration team. If I can get them to set up a virtual directory like
you describe, things will be really easy for me.

Thanks for the idea.
-- Manohar



Jake Marx said:
Hi Srinivas,

I think "image/tiff" is the correct content-type for TIFF images.

John is correct - IE won't natively display TIFF images without a plugin or
forcing a download. However, maybe we can simplify things a bit. You could
just serve up the images directly via a URL without using ASP. For example,
you could set up a virtual directory under your website root named "images",
which points to a certain location on the web server that contains the TIFF
images. Then, your code could just hyperlink directly to the image URL
(http://myserver/images/test.tif). The first time the user hits the link,
he/she will have to uncheck the "always ask before opening this type of
file". Each time after that, however, the image should pop up in the user's
default TIFF viewing application.

This doesn't add hide the image names, but it will hide the image location,
and the user will not be able to modify the image on the server.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas said:
Jake,
Thanks a bunch for the code.
I followed the example you gave. It should have worked, except for
one thing I ignored to mention.
The image files I have are .tif files. (I did not realise this could
make a difference). When I ran the asp page, instead of displaying
the image in the browser,
it prompted me if to select open or save. In the place where the
image is supposed to be displayed, I see a lot of strange looking
text. My guess is I do not have the right Content type. I have tried
"application/tif" and "image/tif". Neither worked.

In our installation we have something called "Imaging for Windows
Preview" that is launched when we double click on a .tif file. Is
there any way to force the browser to launch this program and display
the image in it? Thanks for your help
--M



Jake Marx said:
Hi Srinivas,

Here's some sample ASP code that should get you started:

<%@ Language=VBScript EnableSessionState=False%>
<%Option Explicit%>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=0

Dim objStream, sImgName

sImgName=Request.QueryString("imageName")

If Len(sImgName) Then
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile "C:\images\" & sImgName
Response.ContentType = "image/jpeg"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Else
Response.Write "Invalid image name."
End If
%>

This code assumes that your images are placed in C:\images\ (on the
web server's hard drive). Excel (or wherever you place your
hyperlinks) should link to
http://servername/folder/filename.asp?imageName=image1.jpg or
similar. Notice that the actual filename of the image (without the
path) is passed in via the imageName argument in the querystring.
You could do this differently - i.e., create a mapping of codes to
filenames, which would add a bit more complexity. But it shouldn't
be too difficult.

Unless the users have rights to view the source of the ASP document
(can only be done through the file system, and they shouldn't have
rights to files on the server anyway), they will never know where
the images came from.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas Chundi wrote:
Jake,
Since I could not get our operations to let me use a web server, my
original idea was to create a dll that could be installed on users
machines. This dll could have functions that can copy the images
from the server to a temporary location on the users' machine. But
later, I realized that the number of users could be fairly big. So
I am in the process of convincing them to use the web server, in
the manner you describe.

Can you please point me to an example or some helpful links.
Thanks for your help.
--M



Hi Srinivas,

I think the only way you're going to be able to "hide" the real
location of the images is by adding a second layer to the process.
For example, you could store the images in a database.
Alternatively, you could create an ASP document that streams the
binary output of the image when a user hits it. For example, you
could link to a URL like this:

http://myintranet/myimages/getimage.asp?imageid=20032

The ASP code would process the URL, grab the associated image from
the filesystem, and stream it back to Excel. This would hide the
original location of the image.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Srinivas Chundi wrote:
I have explored this. The user can select the cell containing the
hyperlink, copy it to the clipboard (Ctrl+C) and paste it in MS
word. From here he can right click on the link to edit or view it.
The protection is no longer available once the user goes out of
the Excel spreadsheet. Unless I am missing something.
-M

If you lock the cell (default) in Format=>Cells, protection tab
and also select hidden and then protect the worksheet under
Tools=>Protection=>Protect sheet with a password, doesn't that do
what you want.

This certainly isn't foolproof as password crackers are easy to
come by, but does provide some security.

Obviously, you need to specify a display value, not have it
default to the fully qualified path to the file.

--
Regards,
Tom Ogilvy



Using VB6, I have created an excel spreadsheet. Some cells
contain a hyperlink to TIF image files on a specific server
within the LAN. When the user clicks on any one of these cells,
it launches a copy of Imaging software and displays the image
the hyperlink is pointing to.

Is it possible to let the users view the images, like they are
currently doing, without giving them direct read access to the
specific location where the image files are located? I need to
do this to ensure that the users do not view/access the images
by any means other than clicking on the hyperlink. Also, the
location of the images should be hidden from them and they
should not be able to edit or copy/paste the hyperlink to a
different software, such as word. In essance, the users should
not know where the images are actually located and they should
not be able to get to them by any other means, say using
windows explorer or word.

It is really important that I accomplish something as close to
this as possible.
Any help is greatly appreciated.
Thanks
-- M
 
Back
Top