Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Thumbnail on ASP.Net page
Hiral
Can anyone help me in how to show mediabin thumbnail to asp.net image control?
I found example of it for windows based picturebox control which is as follows. But i want to put thumbnail on web page and I don't know how I can do it.
Windows based example:
Public Function ReturnThumbNails()
Dim session As New MBPSCRIPTMODEL2Lib.MBSession
Dim container As MBPSCRIPTMODEL2Lib.MBContainer
Dim MetadataCollection As MBPSCRIPTMODEL2Lib.MBObjectCollection
Dim MetaDataValue As MBPSCRIPTMODEL2Lib.MBMetaDataValue
Dim MediaBinAsset As MBPSCRIPTMODEL2Lib.MBAsset
Dim strAssetID As String
Dim array As Array
Try
strAssetID = your asset guid
With session
.Logon("srvr", "domain", "username", "pwd*")
MediaBinAsset = .GetAsset(strAssetID)
End With
With MediaBinAsset
array = .Preview(PreviewThumbnail)
End With
PictureBox1.Image = Image.FromStream(New MemoryStream(array))
Return True
Catch ex As System.Exception
MsgBox(ex.Message)
Return False
End Try
End Function
can anyone help me how to display thumbnails on asp.net webpage?
Thank You,
Hiral
Find more posts tagged with
Comments
Migrateduser
I think that it cannot work (at least not with IE).
You'll have to create an aspx page whose sole goal is to stream the binary content of the thumbnail in the response, doing something like this in a page called ShowPreview.aspx:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
MediaBinServer MBSession = <get your MB session here>
string AssetID;
AssetID = Request.QueryString["ID"];
Response.BinaryWrite(MBSession.GetPreview(AssetID, -1, -1, MBPreviewType.Preview_128x128));
}
Then in your other aspx page you will display IMG tags as follows:
<img src="ShowPreview.aspx?ID=<assetID>">
Folco Banfi
masterpage.jpg
Hiral
Thank You !