Hi,
I am working on an ASP.NET 1.1 application that creates thumbnails using the
code below.
Problem is that the code loads an entire file into memory to instantiate the
image (file.Data is a memorystream).
This obviously isnt feasible for large files. Does anybody know of a
thumbnail component that doesn't load the entire file into memory?
Image fullImage = Image.FromStrea m(file.Data);
// maximum height or width is 100
double imgWidth = Convert.ToDoubl e(fullImage.Wid th);
double imHeight = Convert.ToDoubl e(fullImage.Hei ght);
double divisor = 0;
if(fullImage.He ight fullImage.Width )
{
divisor = (100/imHeight);
}
else
{
divisor = (100/imgWidth);
}
Image thumbnail =
fullImage.GetTh umbnailImage(Co nvert.ToInt32(i mgWidth*divisor ),
Convert.ToInt32 (imHeight*divis or),
new System.Drawing. Image.GetThumbn ailImageAbort(r tnVal.Thumbnail Callback),
IntPtr.Zero);
--
Regards,
Phillip Johnson (MCSD For .NET)
PJ Software Development
I am working on an ASP.NET 1.1 application that creates thumbnails using the
code below.
Problem is that the code loads an entire file into memory to instantiate the
image (file.Data is a memorystream).
This obviously isnt feasible for large files. Does anybody know of a
thumbnail component that doesn't load the entire file into memory?
Image fullImage = Image.FromStrea m(file.Data);
// maximum height or width is 100
double imgWidth = Convert.ToDoubl e(fullImage.Wid th);
double imHeight = Convert.ToDoubl e(fullImage.Hei ght);
double divisor = 0;
if(fullImage.He ight fullImage.Width )
{
divisor = (100/imHeight);
}
else
{
divisor = (100/imgWidth);
}
Image thumbnail =
fullImage.GetTh umbnailImage(Co nvert.ToInt32(i mgWidth*divisor ),
Convert.ToInt32 (imHeight*divis or),
new System.Drawing. Image.GetThumbn ailImageAbort(r tnVal.Thumbnail Callback),
IntPtr.Zero);
--
Regards,
Phillip Johnson (MCSD For .NET)
PJ Software Development