Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

MHT Format
chrisdoan
#1 Posted : Tuesday, 22 December 2009 6:44:49 AM(UTC)
Rank: Advanced Member

Joined: 21/12/2009(UTC)
Posts: 82
Location: San Diego

I have an MHT file (MIME HTML) that contains text and images, it would be nice if GSP add this file format in the next release.
Roger Martin
#2 Posted : Tuesday, 22 December 2009 11:51:32 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

Good idea. I looked into this and agree it would be a good addition.

The good news is you can add it today with a little editing of galleryserverpro.config. It is a two-step process: (1) Add a MIME type for the file extension to the <mimeTypes> section. (2) Add an HTML template to tell GSP how to render this file in the browser.

1. Open galleryserverpro.config in a text editor and add the following to the <mimeTypes> section:

Code:
<mimeType fileExtension=".mht" browserId="default" type="message/rfc822" allowAddToGallery="true" />


2. Add the following to the <mediaObjects> section:

Code:
<mediaObject
mimeType="message/rfc822">
    <browsers>
        <browser
id="default"
htmlOutput="&lt;p class=&quot;gsp_textcenter&quot;&gt;Your browser cannot display this file.&lt;/p&gt;&lt;p class=&quot;gsp_textcenter&quot;&gt;&lt;a href=&quot;{MediaObjectAbsoluteUrlNoHandler}&quot; title=&quot;Click to open {TitleNoHtml}&quot;&gt;Click to open&lt;/a&gt;&lt;/p&gt;" />
        <browser
id="ie"
htmlOutput="&lt;p&gt;&lt;a href=&quot;{MediaObjectUrl}&quot;&gt;Enlarge to fit browser window&lt;/a&gt;&lt;/p&gt;&lt;iframe src=&quot;{MediaObjectUrl}&quot; frameborder=&quot;0&quot; style=&quot;width:680px;height:600px;border:1px solid #000;&quot;&gt;&lt;/iframe&gt;" />
    </browsers>
</mediaObject>


Since only IE can render .mht files, there are two <browser> elements - the default one (id="default") that says "Your browser cannot display this file" and then displays a link. And an IE-specific one (id="ie") that renders the file in an <iframe> and also includes a link to open it in the full browser window.

You can tweak the template to suit your needs. The Admin Guide has more info on modifying HTML templates.

Good luck,



Roger Martin
Creator and Lead Developer of Gallery Server Pro
chrisdoan
#3 Posted : Tuesday, 22 December 2009 1:37:41 PM(UTC)
Rank: Advanced Member

Joined: 21/12/2009(UTC)
Posts: 82
Location: San Diego

Thanks Roger. I followed your instructions and was able to add the MHT file to GSP. It worked like a charm :-)
chrisdoan
#4 Posted : Tuesday, 12 January 2010 6:01:03 AM(UTC)
Rank: Advanced Member

Joined: 21/12/2009(UTC)
Posts: 82
Location: San Diego

Actually, this only worked in IE8. Chrome gave me an error! Seems to be cross browser problem?

Please visit the link below with Google Chrome and you'll see the error:
http://www.cdsoftwaresol...media/MediaGallery.aspx

This file is a little large at 16 MB so it will take a few seconds to load.
Roger Martin
#5 Posted : Tuesday, 12 January 2010 11:36:25 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

Your .mht file is current giving an error - my guess is that you are playing with the HTML template. Let me know when it is working and I'll take a look.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
chrisdoan
#6 Posted : Tuesday, 12 January 2010 1:54:43 PM(UTC)
Rank: Advanced Member

Joined: 21/12/2009(UTC)
Posts: 82
Location: San Diego

I don't think the .mht file is the problem. I put a .jpg file in the same folder and it had the same problem. You can check it out yourself using the URL below:

http://www.cdsoftwaresol...media/MediaGallery.aspx

If I click the .jpg file in IE8, it works fine. If I click the same file in Chrome, I got an error below. Why would GSP behave differently between these 2 browsers?

"An error occurred.
We are sorry, but Gallery Server Pro encountered an error. It has been logged and, if error reporting is enabled, an email describing the problem has been sent to the administrator.
Error: Expected this.MediaObjectPhysicalPath ("D:\Gallery Server Pro\Photos\Miscellaneous\Miss Universe - Croatia.mht") to start with AppSetting.Instance.PhysicalApplicationPath ("C:\inetpub\wwwroot\gallery\"), but it did not. If the media objects are not stored within the Gallery Server Pro web application, you cannot use the MediaObjectAbsoluteUrlNoHandler replacement parameter. Instead, use MediaObjectRelativeUrlNoHandler and specify the virtual path to your media object directory in the HTML template in the galleryserverpro.config file. For example: htmlOutput="&lt;a href=&quot;http://yoursite.com/media{MediaObjectRelativeUrlNoHandler}&quot;&gt;Click to open&lt;/a&gt;"
Error Summary
Url
http://www.cdsoftwaresol...efault.aspx?moid=134602
Timestamp
1/12/2010 7:47:14 PM"
Roger Martin
#7 Posted : Tuesday, 12 January 2010 2:19:21 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

That's because the template defines two scenarios - one for IE and the other for all other browsers. Since you are storing your media objects outside the web application directory, you must use the MediaObjectRelativeUrlNoHandler replacement parameter instead of MediaObjectAbsoluteUrlNoHandler.

Look in the HTML template and find "MediaObjectAbsoluteUrlNoHandler". Replace it with something like this:

Code:
http://yoursite.com/media{MediaObjectRelativeUrlNoHandler}


The text in front of {MediaObjectRelativeUrlNoHandler} should be a virtual directory you define in IIS. This is necessary so that the link in the browser can point to an object on your server.

For more info, read the error message very closely. You can also find more info about replacement parameters in the Admin Guide.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
chrisdoan
#8 Posted : Tuesday, 12 January 2010 2:46:06 PM(UTC)
Rank: Advanced Member

Joined: 21/12/2009(UTC)
Posts: 82
Location: San Diego

"MediaObjectAbsoluteUrlNoHandler" was part of the code you gave me to put inside the .config file to play .mht files so I had no idea...I changed it to "GalleryServerPro_Misc{MediaObjectRelativeUrlNoHandler}" and was able to display photos (.jpg files) but still got the error "Your browser cannot display this file." playing the .mht file in Chrome. GalleryServerPro_Misc is a virtual directory in IIS that points to the physical path "D:\Gallery Server Pro\Photos\Miscellaneous" where the .mht file is located.
Roger Martin
#9 Posted : Tuesday, 12 January 2010 11:29:05 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

That is expected. Please re-read my first response. In short, only IE can natively render .mht files, so for other browsers the best we can do is present a link to the user.

You can change this behavior by editing the HTML template I gave you. Read more about them in the Admin Guide.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
chrisdoan
#10 Posted : Wednesday, 13 January 2010 11:08:17 AM(UTC)
Rank: Advanced Member

Joined: 21/12/2009(UTC)
Posts: 82
Location: San Diego

OK Thanks. I'd just put up a message telling the users to use IE to access .mht files.
Rss Feed  Atom Feed
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.