Article How to: load images inline

This article originated from a customer question.

Problem

Images in the blog by default open to a full-sized view of the image. Since updating Telligent Community Server, this no longer works; instead we are getting a File Download pop-up window. We suspect that this is due to changes to the image handler?

Unfortunately this is not ideal in our case. Does anyone have any suggestions on how to mitigate or fix this?

Solution

This behavior can be changed by updating the communityserver.config file.  

Inside communityserver.config is a section called MimeTypes. This relates the mime type to a particular file extension, it also indicates if a file type should be forced to be downloaded or not.  

To change the behavior for jpg files, for example, you would change the mime type entry for .jpg so that it looks like the following. The part that was added was the forceDownload="false".

<mimeType extensions="jpg,jpeg" mimeType="image/jpeg" forceDownload="false" />

You will want to make this change for bmp, gif, png, and jpg. The default is to force a file to be downloaded when it is accessed directly through the centralized file store handler.

The recommended way to make this change to the configuration is to use a communityserver_override.config file.

This will update the configuration but make it easier to upgrade your site in the future. Below is a communityserver_override.config file that you can use to make these updates to the image mime type entries.

<?xml version="1.0" encoding="utf-8"?>
<Overrides>
<Override xpath="/CommunityServer/MimeTypes/mimeType[@extensions='jpg,jpeg']"
mode = "new"
name="forceDownload"
value="false" />
<Override xpath="/CommunityServer/MimeTypes/mimeType[@extensions='gif']"
mode = "new"
name="forceDownload"
value="false" />
<Override xpath="/CommunityServer/MimeTypes/mimeType[@extensions='bmp']"
mode = "new"
name="forceDownload"
value="false" />
<Override xpath="/CommunityServer/MimeTypes/mimeType[@extensions='png']"
mode = "new"
name="forceDownload"
value="false" />
</Overrides>

After you have made these changes, you should touch your web.config by opening and saving it in Notepad.