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