How might I launch MS Photo Editor and load a specific .jpg into it from an ASP.NET app?
I can’t find a namespace that refers to it and have know idea what the reference might be.
thanks
How might I launch MS Photo Editor and load a specific .jpg into it from an ASP.NET app?
I can’t find a namespace that refers to it and have know idea what the reference might be.
thanks
I am a java developer, so take this for what it’s worth. Are you downloading the jpg? If the app in question is the default app for that file extension, won’t it open?
You can create a link to the .jpg file, but it will open in whatever application is set as the default for .jpgs on the client’s machine.
What if the user doesn’t have MS Photo Editor installed?
ETA: Actually, it will probably load the jpg in the browser, since that would be the browser’s default.
I’m a bit mystified as to what you’re trying to accomplish, here. Do you want to load Photo Editor on the server side and then deliver the JPEG to the client? Or are you trying to invoke the application on the client side? If the latter, I don’t think you can do it. If the former, I can’t imagine why you’d want to do that; you can do a great number of graphic manipulations in .NET (ASP or otherwise, with System.Drawing.Graphics) without resorting to external applications.
Completely in house intranet app for maybe a dozen people. There will be a path to a .jpg located on a local server stored in a database. The client would then click the .jpg they want to look at and have it open in MS Photo. Or a word file and have it open in word, or and xcel file and have it open in excel.
(I have the word and excel part figured out)
eta, it doesn’t have to be a MS Photo app. But they have to be able to zoom and pan in the .jpg
Could the op’s intention be acheived with a shell call? (Or does that just work in vbscript scripts and not asp.
I know a lot of stuff that works in an asp file will work virtually unchanged in a vbs file and vice versa.
edit: Because that would be trying to load the ms photo that’s located on the web server not the one located on the user’s machine.
Go back to sleep Lobsang
Hmm… let’s think about this. With word and excel… if the users have the office suite installed, then downloading documents off a website will normally have them open up in office okay - maybe inside a browser window add-in, maybe not, depending on their setup, but they’ll have all office features available.
If they click on a link to a jpg picture, the web browser will go ‘okay, I can show them this’ by default even if they have another program set up as the shell jpg editor.
The only way I know to change this behaviour for most browsers would be to add a content-disposition attachment header to the jpg file. This will mean that they get an ‘open or save’ dialog box when they click on the link, and if they open it, it will open in their default picture editor.
In order to apply this header to an arbitrary jpg, you’ll probably have to serve the image up through an asp.net go-between - probably using something like ADO stream objects. Has anybody ever tried this before? I’m not sure offhand of what the syntax would be.
ETA: Hi sleepy Lobsang
Have you looked into either building a control or purchasing one that does this sort of thing (zooming)?
Google “asp.net image zoom” and see what you get. For example, this looks like it would be a good place to start.
Thanks everyone.
I better expand on this a bit. ASP.NET client/server is quite new to me.
And to let you know, in this development phase my machine is acting as both client and server. I think I’m about to be disappointed.
Here’s the basics –
It’s a work order application used by two departments. GIS and the Assessor, small county Gov.
The Assessor will create a new work order ticket for a property change/addition. We are collecting meta data about that user and comments, directions and questions about the property in question.
They can then browse to a file, and ‘link’ or a better word would be associate it to the work order ticket. What actually happens here is the file name and WorkOrderID# is stored in a table. The actual document is in a server that we can all get to.
When GIS opens the Work Order Ticket, they will see the associated documents in a drop down list.
When selectedindexchanged on the drop down is fired. I get the name of the document from the table.
Then open it in its native application. (I’m not at work now, so the code below might now be quite right)
Dim doc as word.document
Set doc = new word.document
doc.open(“name.doc”)
This works. But I’m afraid that the document is actually being opened on the server.:smack: I don’t want to actually download the documents to the client.
I guess the question is – Can a browser initiate the opening of an application on the client machine, and load a document from a shared source?
You can do what you want. the trick is the web server just sends javascript to the browser which triggers the activeX which corresponds to ms photo editor and passes it the url of the relevant doc.
This will work for an in-house app where you know which broswer version everybody is using & you know everybody has photo editor, or whatever app you want to use instead. It will also require everybody’s browser to be set up to trust unsafe script from your server’s url.
This really isn’t an asp.net issue, in that all the dropdown’s SelectedIndexChanged event is going to do is plug the target file url into the javascript & send it back to the browser. In fact, you’d do better to make that browser-side too, using the browser’s indexchanged event. At that rate, on initial page load the server code just enumerates the database to create the DD & sends out the static script. The page never has any postback at all.
I don’t have cookie cutter javascript for you, but look up launching activeX & you’ll get there. The photo editor app will have a CLSID in the registry which defines its launch point (I forget the technical term, "launch point’ is NOT it) & once you know that, it’s not much harder than “C:>PhotoApp.exe -open http://myserver/somefile.jpg”
Not using any javascript in this app. I would rather not. Though I have previously, and my previous app uses AJAX.
So, this code in my aspx.vb page – on selectedindexchanged event, I get the path to the file from a database and -
Dim doc as word.document
Set doc = new word.document
doc.open(“name.doc”)
Is this just lanching word on the server? I’ll access it on Monday from a different machine. I think I’m pretty much screwed. I’m a GIS guy and DB designer. This really shouldn’t be this hard. But maybe it’s just me.
I need to get set up in a true client/server enviorment again. I am currently developing as server and client on one box.
Yeah, your code is just launching Word on the server. Which is a) a really bad idea for a server with much volume*, b) not legit under the licensing restrictions, and c) not accomplishing your goal.
The only way to start an external app on the client is to have your server push some code to the client which the browser wil execute on the client to start your external app. Javascript is one way, and probably the simplest given your simple goal.
Given that you are in a closed in-house environment, another way is to write a simple .Net Windows App or class which will run in the browser & will start the external photo editor (or BE the photo viewer). Do some reading on “.Net smart client”. It’s pretty easy to create a component which will download & run inside the browser. This lets you avoid messing with javascript & stick to semi-familiar .Net for everything. But if all your .Net work to date has been ASP.Net, you’ll find WinForms .Net to be a whole 'nother universe of classes & objects.
A third idea is to use Silverlight. It’s especially aimed at display of images, and if your real business need is just to pan & zoom in a passive image & not do much else, that might be dirt simple to set up. I’m not up to speed on the exact capabilities of their display control; I know it does zoom, but I’m not sure about pan.
It’s 100% .Net and, conceptually speaking, you just add a Silverlight display control to your page, set its url property to the desired JPG, and render the page. Viola!! The client-side magic takes over, loads your image from the server and presents the user with the UI you need. The only downside is everybody needs to install Silverlight, but that’s no harder or more impactful than installing Flash, which damn near every browser on Earth has downloaded & installed by now. No cost, no licensing hassle for gov’t, the only potential issue is pig-headed IT shop restrictions.
As to separate client & server, get VPC 2007 (it’s free) & load a copy of XP on there with most of the services & crap switched off. You can use that as a valid client which is separate from your dev server without fighting County procurement about getting another PC, or wondering where in your cluttered office you’ll put the box. Other than 5-6GB of disk space, it only consumes resources when you turn it on, so most of the time it won’t hurt your day-to-day work. For basic smoke-checks like this, it’ll run OK in 256MB of RAM.
Thanks for all your advice LSL. I’m going to have to read it a few times. Not sure what route I’m going to take.
This is my forth client server app. Number two is here – (we have been having some network issues, I hope to god it’s up) It loads slow, but has served us well for a few years.
http://maps.co.summit.co.us/arcmap1/viewer.htm
Number three here -
http://maps.co.summit.co.us/dev1/
Don’t know why I’m having such fits with this. Should be a walk in the park
I have procured another machine that I can use as a developement server, so that won’t be a problem.
Not seeing any obvious jScript functions to do this. Any hints?
To review, I want to open word, excel and .jpgs on the client. The server would need to initate this.
Thanks again everyone.
Also, I should mention that the files I want to open (word, excel, .jpgs) Are not located on the client or server, but I can UNC to them.
And sorry, bump.
Duplicate post.