Friday, December 23, 2005

Modifying Resource Browser to Display Thumbnail for Bitmaps

The Resource Browser (Web Author - Resource Manager) ships with MCMS doesn't provide a thumbnail preview for bmp files. That is acceptable as bmp is not a web image format. But if you are interested in showing a thumbnail for bmp files, it can be done via a customized Resource Manager.

1. Create a class inheriting Microsoft.ContentManagement.WebAuthor.ResourcesBrowse
a) Create a class library.
b) Body of the class -

using System;
using System.Drawing;
using Microsoft.ContentManagement.WebAuthor;
using Microsoft.ContentManagement.Publishing;

namespace MCMS
{
public class CustomResourceBrowser : ResourcesBrowse
{
public CustomResourceBrowser()
{
}

//Create a new method to hide the default DataBindResourceColumnThumbnailUrl
protected new string DataBindResourceColumnThumbnailUrl(object dataitem)
{
Resource resource = (Resource)dataitem;
string url = string.Empty;
IntPtr Missing = IntPtr.Zero;
if(resource.FileExtension.ToLower()=="bmp")
{
using(Image image = Bitmap.FromStream(resource.OpenReadStream()))
{
using(Image thumbImage = image.GetThumbnailImage(32,32,null,Missing))
{
thumbImage.Save(@"PhysicalPath"+resource.Name,System.Drawing.Imaging.ImageFormat.Icon);
url = "http://WebPath/"+resource.Name;
}
}
}
else
{
url = resource.UrlThumbnail;
}
return url;
}
}
}

2. Add the following references
a) using System.Drawing
b) System.Web
c) using Microsoft.ContentManagement.WebAuthor
d) using Microsoft.ContentManagement.Publishing

3. Create a temporary folder with appropriate rights for a web user to write data to that. Have the folder in a saver place as it can be assessed by anyone. Make it as a virtual directory. In the PhysicalPath above class replace it with the path of this directory and WebPath with the virtual directory name.

4. Deploy the dll in the bin folder of your MCMS project.

5. Make a copy of ResourcesBrowse.aspx - its default location "C:\Program Files\Microsoft Content Management
Server\Server\IIS_CMS\WebAuthor\Dialogs\ResourceBrowser\Management\"

6. Open ResourcesBrowse.aspx in notepad and change the Page derivative as bellow
<%@ Page language="c#" Codebehind="ResourcesBrowse.aspx.cs" SmartNavigation="true" AutoEventWireup="false"
Inherits="MCMS.CustomResourceBrowser" %>

This will make thumbnail in the temporary folder for bitmap files, which will be referred by Resource Manager - used to show the preview.

Note: Take precautions before using this method as ResourcesBrowse.aspx may get changed without any notification.

7 Comments:

Blogger eemali said...

Private Label Rights

2:00 AM  
Anonymous kajal sharma said...

Independent high services in Mumbai, from collage, corporate world, glamour world, high society, they want enjoyment with others we just meets their desire and demands.

8:21 PM  
Blogger Drik Lover said...

My name is Sonam Oberoi, ludhiana - I am a

young from ludhiana. I am tall, slender, and dress fashionably. Dehradun- I really love men. I don‘t care how

you look like or how old you are. Independent

Ludhiana Escort -
If you are a real gentleman and you are polite, Ludhiana female models courteous and have very

clean cleanliness I will give you the best time of your life.

Ludhiana Escort Service
Ludhiana Escorts
Independent Ludhiana Escort
Escorts In Ludhiana
Ludhiana Escort Female
Ludhiana Escorts Agency

Jalandhar Escorts
Jalandhar Escort Service
Jalandhar Escorts Agency
Jalandhar Escorts Loves
Jalandhar Escorts Female
Independent Jalandhar Escort

Dehradun Escorts
Dehradun Escort Service
Dehradun Escorts Agency
Dehradun Escorts Loves
Dehradun Escorts Female
Indepenent Dehradun Escort

3:55 AM  
Blogger Drik Lover said...

My name is Sonam Oberoi, ludhiana - I am a young from ludhiana. I am tall, slender, and dress fashionably. Dehradun- I really love men. I don‘t care how you look like or how old you are. Independent Ludhiana Escort - If you are a real gentleman and you are polite, Ludhiana female models courteous and have very clean cleanliness I will give you the best time of your life.

4:43 PM  
Blogger Bubli Roy said...

We are offering one of the most new motives and inexpensive rates of Independent Escort in Dehradun with many collections only on for all new strugler clients. Dehradun Escorts Services , Escorts in Dehradun, Dehradun Escorts Girls, Dehradun Escort Models, Dehradun Call Girls, Independent Escorts in Dehradun, Dehradun Escorts, Dehradun Escorts Agency.

Dehradun Call Girls
Dehradun Escort

2:47 AM  
Blogger Julisa Roy said...

Asian escorts are sweet, they listen to you patiently and loves you passionately like you are the only one in this world who matters to them. Hence many straight as well as lesbian and bisexual people now readily looking out for an asian escorts nyc agency which can provide them a beautiful Asian lady with whom they can spend a magical night.

Agra Escort Service
Agra Call Girls
Escort In Agra

Agra Escort Service
Agra Call Girls
Escort In Agra

1:46 AM  
Blogger Jesica pari said...

agra escort
agra escorts
agra escort
agra escort
agra escort

10:26 PM  

Post a Comment

<< Home