Languages :: Visual Basic :: Elsa |
|||
| By: J.M. |
Date: 23/01/2007 22:09:43 |
Points: 20 | Status: Answered Quality : Excellent |
|
Hi, i have an asp.net 2.0 web application. i need to create thumbnails for images. i retreive the images from a folder. how can i create the thumnails, i found a method getThumbnail that must do it, but it didn't work with me |
|||
| By: VGR | Date: 23/01/2007 23:09:31 | Type : Comment |
|
| Well, you can do it using a built-in or third-party library/DLL for jpeg/png images handling. You should search on your asp.net online documentation for "imageresize" or "imagecreatefromfile". PHP can natively do this. asp.net should also. regards |
|||
| By: VGR | Date: 23/01/2007 23:15:01 | Type : Comment |
|
| apparently, system.drawing.image is your friend and will enable you to assess image's width&height the gd's imagecreatefromfile equivalent is System.Drawing.Image.FromFile() but you probably already know all of this... As you found the GetThumbnailImage() method that you can apply on an object of type returned by System.Drawing.Image.FromFile() You can nevertheless look at this page on ASP.Net thumbnail creation good luck... Alternatively, you can probably use a non-managed DLL like Delphi's TJPEG library. It's very efficient. |
|||
| By: Elsa | Date: 24/01/2007 08:47:07 | Type : Answer |
|
| hey J.M., what's up? Create an a class getImages.aspx, u don't to put anything in it. Its code behind is this: Imports Microsoft.VisualBasic Imports System.Drawing Imports System.Drawing.Drawing2D Partial Class getImage Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim folderFile = Server.MapPath(Request.QueryString("img")) Dim oImage As System.Drawing.Image oImage = System.Drawing.Image.FromFile(folderFile) Dim iHeight = oImage.Height / 2 Dim iWidth = oImage.Width / 2 Response.ContentType = "image/jpeg" Dim oThumbnail As System.Drawing.Image oThumbnail = oImage.GetThumbnailImage(iWidth, iHeight, Nothing, Nothing) oThumbnail.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) oImage.Dispose() oThumbnail.Dispose() End Sub End Class Now to display the thumbnail u do this: <img src="getImage.aspx?img=imagePath/imageName" border=0 width=200/> |
|||
| By: vb_elmar | Date: 27/11/2007 00:45:59 | Type : Comment |
|
| Test | |||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








