Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a tif image file using Picture and Fax Viewer

Status
Not open for further replies.

firsttube

Technical User
Apr 21, 2004
165
CA
I want to open a tif image file using Windows Picture and Fax Viewer over the web via a hyperlink. However, I get prompted to save or open the file. Can this be done using vbscript and wscript.shell?

Code:
Dim objWShell
Set objWShell = CreateObject("WScript.Shell")
objWShell.Run("C:\WINDOWS\System32\shimgvw.dll ImageView_Fullscreen myfilepath\image.tif")

set objWShell = nothing

the code does not work.
any ideas on how this can be done?

Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
Probably you dont want the web server computer to run the Viewer program in its own memory because that won't do the users any good and it will also bring the server to its knees if you have a lot of concurrent users.

Since the view should not run on the server, it is not a good candidate to be done in ASP but rather should be done with client-side script.

Is this for a public web site or internal for a company?

If public then I suggest that you cannot rely on all users to even have the proper viewer installed and they might not even be running Windows. In this case it perhaps consider converting the images to anothor format or even PDF so they can be viewed by others.
 
Yes, it is an internal only application. All users have standardized computers so it should work for everyone inside.

I have actually done this before using vb script and "WScript.Shell", but I cannot find my old scripts.


Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
got it:

Code:
<script language="vbscript" type="text/vbscript">
Dim objWShell, strPath
strPath = "c:\mypath\myimage.tif"
Set objWShell = CreateObject("WScript.Shell")
objWShell.Run "rundll32.exe C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen " & strPath

set objWShell = nothing

</script>

Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
OK, so the solution is clien-side code instead of ASP but the next question is: What is the filepath for the image file? Will it always be [tt]"c:\mypath\myimage.tif"[/tt] ? What if the user moves or deletes the file?

Perhaps the image can be on a shared network folder where all users have permission to read files from the folder.
The path could perhaps be:[tt]\\MyServer\SharedFolder\MyImage.tif[/tt]

Also since this is client-side code that will only run on Internet Explorer, you might consider using ASP to detect the browser type and return a notice to user that surf to your page using FireFox, Safari, BlackBerry, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top