C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




ThumbNail Creation in ASP.Net


Posted Date: 06 Nov 2007    Resource Type: Code Snippets    Category: Images

Posted By: Kamal       Member Level: Gold
Rating:     Points: 10



Creation of thumbnails from image in ASP.Net is very easy task.

Following are Steps to create thumbnails image in ASP.Net :

First Imports System.Drawing class

1)Read the Image using the method Image.FromStream() as,

Dim imInputImage, imThumbNail As Image

imInputImage = System.Drawing.Image.FromStream(imgUpload.PostedFile.InputStream)

here,imgUploadis the id of FileUpload Control.

2)Get the ThumbNail Image using the method GetThumbnailImage.

imThumbNail = imInputImage.GetThumbnailImage(100, 100, Nothing, System.IntPtr.Zero)

We can also specify the format of the Thumbnail image we want to save by,

imThumbNail.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)

Some of the Formats can be,

Jpeg- System.Drawing.Imaging.ImageFormat.Jpeg
Gif - System.Drawing.Imaging.ImageFormat.Gif
Tiff- System.Drawing.Imaging.ImageFormat.Tiff
Png - System.Drawing.Imaging.ImageFormat.Png




Responses

Author: JithendraNadh    23 Nov 2007Member Level: Silver   Points : 0
I have this piece of code:

Dim im, thumb As Image
im = System.Drawing.Image.FromStream(imgUpload.PostedFile.InputStream)
thumb = im.GetThumbnailImage(100, 100, Nothing, System.IntPtr.Zero)
thumb.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)

Im getting the error as:

System.NullReferenceException: Object reference not set to an instance of an object. at ThumbNail.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\JITHENDRA\My Documents\Visual Studio 2005\WebSites\WebSite1\ThumbNail.aspx.vb:line 14


Author: amiya behera    02 Jun 2008Member Level: Bronze   Points : 2
hi

i have save images in the database( sqlserver 2005) and also displying it in datalist. but i want to disply in datalist with thumbnail . can u give some idea or source code for it


Author: amiya behera    02 Jun 2008Member Level: Bronze   Points : 2
how make thumbnail dynamically for images which store in databse. its will be disply in datalist with thumbnail.how i will be do it, the code should be in c#, asp.net



Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Create ThumbNail image in ASP.Net
Previous Resource: Capture the form on the screen during runtime
Return to Discussion Resource Index
Post New Resource
Category: Images


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

budget conference call

Contact Us    Privacy Policy    Terms Of Use