473,462 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ASP.Net Thumbnails

I'm doing some work with submitting graphics via ASP.net page to SQL 2000
server using VB.

I know how to get a graphic into the database from a filefield control. I
also know how to pull it out of the database and thumbnail it on the fly.

Creating thumbnail on the fly seems extremely inefficient to me as this has
to be done every time the image is requested. What I want to do is get the
image from the filefield control, thumbnail it and save the thumbnail to the
database along with the full size image. That way the thumbnail process is
only ran once and I'm not to concerned about the extra storage space.

What I cant figure out is how to get the image from the
postedfile.imputstream.read to a system.drawing.image to generate the
thumbnail and then send the thumbnail to the database again.

I'm new to .net so any help is greatly appreciated

Thanks
Chris D
Nov 18 '05 #1
3 1350
Hello

Use System.Drawing.Image.FromStream methof to get the image from the posted
file inputstream
To put the image in the database, Create a MemoryStream object and save the
image to it

System.Drawing.Image origImage =
System.Drawing.Image.FromStream(postedFile.InputSt ream);
postedFile.InputStream.Seek(0, SeekOrigin.Begin); // rewind the input stream
to read it again to store the original image in the database

System.Drawing.Image thumbnail = new System.Drawing.Bitmap(w, h);
//generate the thumbnail

MemoryStream ms = new MemoryStream();
thumbnail.Save(ms);
ms.Seek(0, SeekOrigin.Begin);

byte[] buffer = new byte[ms.Length];
ms.Read(buffer, 0, buffer.Length);

Best regards,

Sherif ElMetainy

"Chris D" <qw*****@hotmail.com> wrote in message
news:3f********@news.nucleus.com...
I'm doing some work with submitting graphics via ASP.net page to SQL 2000
server using VB.

I know how to get a graphic into the database from a filefield control. I
also know how to pull it out of the database and thumbnail it on the fly.

Creating thumbnail on the fly seems extremely inefficient to me as this has to be done every time the image is requested. What I want to do is get the
image from the filefield control, thumbnail it and save the thumbnail to the database along with the full size image. That way the thumbnail process is
only ran once and I'm not to concerned about the extra storage space.

What I cant figure out is how to get the image from the
postedfile.imputstream.read to a system.drawing.image to generate the
thumbnail and then send the thumbnail to the database again.

I'm new to .net so any help is greatly appreciated

Thanks
Chris D

Nov 18 '05 #2
I have tried what you suggested and it seems to work. The images are in the
database.

Where I run into problems is retrieving the images processed by this code.
Is there any special way of retrieving these images. Images submitted with
my old code retrieve fine. Its almost like the format of the image is not
correct. All it does is show a 'X' image

Chris

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
Hello

Use System.Drawing.Image.FromStream methof to get the image from the posted file inputstream
To put the image in the database, Create a MemoryStream object and save the image to it

System.Drawing.Image origImage =
System.Drawing.Image.FromStream(postedFile.InputSt ream);
postedFile.InputStream.Seek(0, SeekOrigin.Begin); // rewind the input stream to read it again to store the original image in the database

System.Drawing.Image thumbnail = new System.Drawing.Bitmap(w, h);
//generate the thumbnail

MemoryStream ms = new MemoryStream();
thumbnail.Save(ms);
ms.Seek(0, SeekOrigin.Begin);

byte[] buffer = new byte[ms.Length];
ms.Read(buffer, 0, buffer.Length);

Best regards,

Sherif ElMetainy

"Chris D" <qw*****@hotmail.com> wrote in message
news:3f********@news.nucleus.com...
I'm doing some work with submitting graphics via ASP.net page to SQL 2000 server using VB.

I know how to get a graphic into the database from a filefield control. I also know how to pull it out of the database and thumbnail it on the fly.
Creating thumbnail on the fly seems extremely inefficient to me as this

has
to be done every time the image is requested. What I want to do is get the image from the filefield control, thumbnail it and save the thumbnail to

the
database along with the full size image. That way the thumbnail process is only ran once and I'm not to concerned about the extra storage space.

What I cant figure out is how to get the image from the
postedfile.imputstream.read to a system.drawing.image to generate the
thumbnail and then send the thumbnail to the database again.

I'm new to .net so any help is greatly appreciated

Thanks
Chris D


Nov 18 '05 #3
Never mind, I got it to work.

Thanks a lot for the help

Chris

"Chris D" <qw*****@hotmail.com> wrote in message
news:3f********@news.nucleus.com...
I have tried what you suggested and it seems to work. The images are in the database.

Where I run into problems is retrieving the images processed by this code.
Is there any special way of retrieving these images. Images submitted with
my old code retrieve fine. Its almost like the format of the image is not
correct. All it does is show a 'X' image

Chris

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
Hello

Use System.Drawing.Image.FromStream methof to get the image from the posted
file inputstream
To put the image in the database, Create a MemoryStream object and save

the
image to it

System.Drawing.Image origImage =
System.Drawing.Image.FromStream(postedFile.InputSt ream);
postedFile.InputStream.Seek(0, SeekOrigin.Begin); // rewind the input

stream
to read it again to store the original image in the database

System.Drawing.Image thumbnail = new System.Drawing.Bitmap(w, h);
//generate the thumbnail

MemoryStream ms = new MemoryStream();
thumbnail.Save(ms);
ms.Seek(0, SeekOrigin.Begin);

byte[] buffer = new byte[ms.Length];
ms.Read(buffer, 0, buffer.Length);

Best regards,

Sherif ElMetainy

"Chris D" <qw*****@hotmail.com> wrote in message
news:3f********@news.nucleus.com...
I'm doing some work with submitting graphics via ASP.net page to SQL 2000 server using VB.

I know how to get a graphic into the database from a filefield
control. I also know how to pull it out of the database and thumbnail it on the fly.
Creating thumbnail on the fly seems extremely inefficient to me as
this
has
to be done every time the image is requested. What I want to do is get the image from the filefield control, thumbnail it and save the thumbnail
to the
database along with the full size image. That way the thumbnail
process is only ran once and I'm not to concerned about the extra storage space.

What I cant figure out is how to get the image from the
postedfile.imputstream.read to a system.drawing.image to generate the
thumbnail and then send the thumbnail to the database again.

I'm new to .net so any help is greatly appreciated

Thanks
Chris D



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Lemming | last post by:
Hi, I'm putting together a website for a local estate agent. One of the things they want to do is upload property descriptions/prices/etc. plus a picture of the property which is for sale.
5
by: Ken | last post by:
I am in the process of designing my first web-site, and am having a problem with my picture gallery. My thumbnails are all different sizes, I would like them to be one size. The manual does not...
6
by: c d saunter | last post by:
Greetings All, In Widows Explorer there is a thumbnail view, where you see images as thumbnails. Applications such as MS Office and OpenOffice, when installed, cause their respective filetypes to...
4
by: Rednelle | last post by:
Greetings all, As a newbie, using Access 2000, I would appreciate advice on the best way to include pictures. I have developed a 'Home Inventory' database which can include jpeg thumbnails of...
3
by: Vagabond Software | last post by:
I'm trying to display thumbnail images in a Listview that look more like the Windows thumbnail view. Everything is working pretty good, but my thumbnails are decidedly not like the Windows...
1
by: Espen Evje | last post by:
Hi, I am trying to present the images in a folder as thumbnails in a dynamically created asp:table. I however do not want to save the thumbnails to disk, only show the images in this folder as...
6
by: Rich | last post by:
Hello, I want to simulate the dynamic thumbnail display of Windows Explorer (winxp) on a form or pannel container. If I place a picture box on my container form/pannel and dimension it to the...
4
by: Barely Audible | last post by:
Guys I was wondering if it was possible to have a js file that, when the page loaded, it automatically generated a a set of thumbnails from directory of the page on the web server? Or would...
5
by: JJ | last post by:
I have a gallery-like application. (The gallery will be actually presented in Flash, but the management (cms) of the images will be in asp.net. ) My question is, is it ok to create Thumbnail...
1
by: iswar | last post by:
hi friends asp.net(2.0) c# i am trying to create an image gallery in which all the uploaded image are converted into thumbnails and i want to bind these thumbnails into gridview. and on clicking...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.