.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 21st, 2003, 08:59 AM
akashthakural akashthakural is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Chandigarh
Posts: 6 akashthakural User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 59 sec
Reputation Power: 0
Send a message via MSN to akashthakural Send a message via Yahoo to akashthakural
Lightbulb Thumbnail Generation in ASP.NET using C#

Can someone tell me how to generate thumbnnails in ASP.NET using C#. I want the thumbnail to be generated of particular width and height of the photo uploaded of anysize.

Can anybody help me in doing that?

Reply With Quote
  #2  
Old March 9th, 2004, 02:13 PM
StudioReview StudioReview is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 30 StudioReview User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
try looking at

System.Drawing.Drawing2D
System.Drawing.Imaging

this article may also help:

http://www.eggheadcafe.com/articles/20030515.asp
__________________
Tivo Codes, Hacking the Tivo, and Adding a Second Drive to Your Tivo.
All this information at www.TivoSpy.com !

Reply With Quote
  #3  
Old March 14th, 2004, 10:05 PM
busyweb busyweb is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 5 busyweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Keep Original Image Proprotion

Const THUMB_WIDER As Int32 = 90 ' can be dynamic value with parameters
Const COMPRESSION_QUALITY As Int32 = 90 ' can be dynamic


Public Sub SaveThumbSize(ByVal sSource As String, ByVal sDestination As String)
imgSrc = New Bitmap(sSource)
Dim ratio As Double
If imgSrc.Width > imgSrc.Height Then
ratio = THUMB_WIDER / imgSrc.Width
imgDstW = THUMB_WIDER
imgDstH = CInt(imgSrc.Height * ratio)
Else
ratio = THUMB_WIDER / imgSrc.Height
imgDstH = THUMB_WIDER
imgDstW = CInt(imgSrc.Width * ratio)
End If
imgDst = New Bitmap(imgSrc, imgDstW, imgDstH)
SaveImage(imgDst, sDestination, COMPRESSION_QUALITY)

imgDst.Dispose()
imgSrc.Dispose()
imgDst = Nothing
imgSrc = Nothing
End Sub

Public Sub SaveImage(ByRef img As Image, ByVal dest As String, ByVal compression As Integer)
Dim EncoderParams As New EncoderParameters(1)
Try
EncoderParams.Param(0) = New EncoderParameter(Encoder.Quality, compression)
img.Save(dest, GetEncoderInfo, EncoderParams)
Catch ex As Exception
'img.Save(dest)
End Try
EncoderParams.Dispose()
EncoderParams = Nothing
End Sub

Private Function GetEncoderInfo() As ImageCodecInfo
Dim encoderReturn As ImageCodecInfo = Nothing
Dim encoders As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders
Dim encoder As ImageCodecInfo
For Each encoder In encoders
If encoder.MimeType = "image/jpeg" Then
encoderReturn = encoder
End If
Next
encoders = Nothing
Return encoderReturn
End Function

========================
http://www.busyphoto.com
http://mobile.busyphoto.com
========================

Reply With Quote
  #4  
Old September 15th, 2004, 05:27 AM
akashthakural akashthakural is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Chandigarh
Posts: 6 akashthakural User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 59 sec
Reputation Power: 0
Send a message via MSN to akashthakural Send a message via Yahoo to akashthakural
Quote:
Originally Posted by akashthakural
Can someone tell me how to generate thumbnnails in ASP.NET using C#. I want the thumbnail to be generated of particular width and height of the photo uploaded of anysize.

Can anybody help me in doing that?


This can be done by using an object of System.Drawing.Image

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Thumbnail Generation in ASP.NET using C#


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT