Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Thumbnail

Status
Not open for further replies.

kennyaidan

Programmer
Apr 9, 2003
54
IE
Hi, i am trying to create thumbnails using asp.net. I am trying to take in an image file and i create a thumbnail of that file. I think my code works fine until i have to give the thumbnail a name and save it. I have created a thumbnail using the following bits of a code

'declare thumbImage
Dim thumbImage as System.Drawing.Image

'declare currentImage, got from a control called MyFile
FileName.InnerHtml = MyFile.PostedFile.FileName
Dim currentImage as System.Drawing.Image = System.Drawing.Image.FromFile(FileName.InnerHtml)

'create thumbnail
thumbImage = currentImage.GetThumbnailImage(50, 50, nothing, nothing)

When i try to name and save "thumbImage"
Dim strFileName as string
strFileName = thumbImage

I get the following error
Value of type 'System.Drawing.Image' cannot be converted to 'String'.
Line 53: strFileName1 = thumbImage

I'm sure there is an easy way of doing this but i can't seem to find it. I want to be able to save "thumbImage"
as c:/my pictures/example_thb.gif
Any help greatly appreciated
thanks
aidan
 
i've never dealt with saving thumbnails, but it looks like you should be setting your string to something like:
Code:
strFileName="c:/my pictures/example_thb.gif"

then there must be a method that takes the filename as an arguement to save the image. (at least i would think, never having done it). Otherwise you are just assigning that object to the string, which doesn't seem to make sense.

hth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top