|
|
Rank: Administration
Joined: 8/3/2007 Posts: 847 Location: Fort Atkinson, WI
|
Currently, if you add a PDF to Gallery Server and then click on its thumbnail image, you get the following message: Your browser cannot display this media object, but you can download it by clicking the download link in the toolbar.This will occur even if you have the PDF plug-in installed in your browser. You may wish to have the PDF appear immediately in the plug-in, much like when you normally click on a PDF link on the internet. Gallery Server does not do this by default because the plug-in takes over the whole browser window, forcing the user to use the browser's back button to get back to Gallery Server. To have the PDF appear in the browser's plug-in when you click on the PDF's thumbnail image, add a new <mediaObject> element to the galleryObject/mediaObjects section of galleryserverpro.config (in the config directory), like this: Code:<galleryObject> <mediaObjects> ... existing config settings...
<mediaObject mimeType="application/pdf"> <browsers> <browser id="default" htmlOutput=" <script type='text/javascript'> window.location='{MediaObjectUrl}'; </script>"> </browser> </browsers> </mediaObject>
</mediaObjects> </galleryObject> This will cause Gallery Server to render a bit of javascript that will redirect the user to a full page version of the PDF file. You can tweak the javascript as desired (for example, to open a new tab instead of replacing the current window). Add similar <mediaObject> elements for other MIME types such as Word docs, etc. Read the section Rendering Media Objects to the Browser in the Admin Guide for more info. Cheers!
Roger Martin Lead Developer for Gallery Server Pro
|
|
Rank: Member
Joined: 10/29/2008 Posts: 12 Location: Shanghai
|
I tried to paste the codes directly into galleryserverpro.config but returned error
Parser Error Message: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 70, position 1.
Source Error:
Line 68: <browsers> Line 69: <browser id="default" htmlOutput=" Line 70: <script type='text/javascript'> window.location='{MediaObjectUrl}'; </script>"> Line 71: </browser> Line 72: </browsers>
Do I need to insert a javascript into the above codes?
|
|
Rank: Administration
Joined: 8/3/2007 Posts: 847 Location: Fort Atkinson, WI
|
Oops. You should escape the < and > with < and >. I corrected the original post.
Roger Martin Lead Developer for Gallery Server Pro
|
|
Rank: Member
Joined: 10/29/2008 Posts: 12 Location: Shanghai
|
Great thanks Roger. It works fine! Is there any sample codes I can find for opening MIME docs in a new browser? I'm a newbie in web programming.
|
|
Rank: Administration
Joined: 8/3/2007 Posts: 847 Location: Fort Atkinson, WI
|
You mean, instead of the current web page being replaced with your PDF, you want it to open in a new tab or browser window? If so, that should be a simple change to the HTML template in galleryserverpro.config. Notice that all you are doing is specifying a little javascript:
window.location='{MediaObjectUrl}';
{MediaObjectUrl} is replaced by the actual URL at runtime. I don't know if off the top of my head, but you should be able to quickly google how to modify this to open in a new tab instead of the current window. It is standard javascript and not specific to GSP.
Roger Martin Lead Developer for Gallery Server Pro
|
|
Rank: Newbie
Joined: 6/16/2008 Posts: 2
|
Hi Guys,
I am new here, this is my first post. I am not the coding guy, so I tried very hard to follow the example and finally I can read pdf, word & ppt files but for pps file (powerpoint slideshow) can't work. What is the correct coding for pps file?
|
|
Rank: Administration
Joined: 8/3/2007 Posts: 847 Location: Fort Atkinson, WI
|
Add the .pps mime type to galleryserverpro.config. That is, scroll down to the <mimeTypes> section and add this line: Code:<mimeType fileExtension=".pps" browserId="default" type="application/vnd.ms-powerpoint" allowAddToGallery="true" /> Then add a new HTML template just like you did for the others: Code:<mediaObject mimeType="application/vnd.ms-powerpoint"> <browsers> <browser id="default" htmlOutput=" <script type='text/javascript'> window.location='{MediaObjectUrl}'; </script>"> </browser> </browsers> </mediaObject> I will include .pps as a mime type in future versions of GSP.
Roger Martin Lead Developer for Gallery Server Pro
|
|
Rank: Newbie
Joined: 6/16/2008 Posts: 2
|
Hi Roger,
Thank you very much for your coding. It is working now. By the way what code to add to make it full screen view when opening photo(slideshow), video & documents such as word, excel & ppt/pps?
Thanks & cheers.
|
|
Rank: Administration
Joined: 8/3/2007 Posts: 847 Location: Fort Atkinson, WI
|
I don't know how you do the full screen thing, if it is even possible. It will depend on the plug-in you use. If you figure out what javascript/HTML will do it, I can help you configure the config file to get it working in GSP.
Roger Martin Lead Developer for Gallery Server Pro
|
|
|
Guest |