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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resizing images 2

Status
Not open for further replies.

mjd3000

Programmer
Apr 11, 2009
136
GB
I am working from this example to resize an image :


I have converted most of the code to C# :

Response.Clear();
Response.ContentType = "image/jpeg";

System.Drawing.Image image = retrieveImage(strEncodedImage);

System.Drawing.Image.GetThumbnailImageAbort dummyCallback;

dummyCallback = new System.Drawing.Image.GetThumbnailImageAbort(new EventHandler(ThumbnailCallback));

System.Drawing.Image thumb;

thumb = image.GetThumbnailImage(600, 350, dummyCallback, IntPtr.Zero);

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

But I'm not sure what to do with this :

Function ThumbnailCallback() as Boolean
Return False
End Function

Can anybody help?
 
Your code would be something like this:
Code:
[COLOR=green]
// This is the main method.
[/color]
void resizeImage()
{
  Image img = retrieveImage(strimg);
  Image thumb = image.GetThumbnailImage(600,350, new GetThumbnailImageAbort(ThumbnailCallback));
  thum.Save(...);
}
[COLOR=green]
// This is a callback method required by the Image.GetThumbnailImage() method.
[/color]
bool ThumbnailCallback()
{  return false;  }
This is untested, wrote it off the top of my head.

hth
 
By the way, I saw 2 similar threads that you also started. Please refrain from doing this to keep this forum clean. :)

happy coding
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top