Regarding inserting images into sqlserver2005 by using asp.net2.0

V

Vijaya Lakshmi

Hai all,
I need a small help regarding inserting images and retrieving
images.Presently i have done inserting images into database by converting
imagetype into binary format and inserted.It is working fine.But there is
one problem by using binaryformat.

This is disadvantages and advantages

The greatest advantage is that, since we store the images in database, more
security is their. And the greatest disadvantage is that, we are making a
database call for each image. So, if we have thousands of rows then, this
process of retrieving image every time will result in low response time.

can u please explain any another way to insert images into sqlserver instead
of converting binary format and then insert.

--
With Reagrds
V.V.Vijaya Lakshmi
Emp No:NGV33058
Jr.Software Engineer
Nanna Computers Pvt Ltd(Vizag)
Mobile No:+919985965598
(e-mail address removed)

(This electronic message contains information from Nanna Computers, which
may be privileged or confidential. The information is for the intended
individual(s) or entity named above. If you are not the intended recipient
be aware that any copying, disclosing, distribution or use of the above
email and/or its attachments is prohibited and is illegal. If you have
received this electronic message in error, please notify us by telephone or
email (to the numbers or address above) immediately. This e-mail is not
un-solicited e-mail under the relevant regulations.)
 
T

Thomas Phaneuf

V.V.,

I have had a similar problem. The way that I solved it was by having a
"image cache" directory where I stored images that were pulled from the
database - with their names being related to where I pulled them from. For
example, if the image was pulled from the Employee database and the primary
key was 11203, then the image on the disk would be
"Employee_11203.jpg", where the extension was whatever I had in the file as
being the image extension.

So, whenever I needed that image, I would have a function that give me
filepath (or relative url) to that image in the image cache file, or pull
the image from the database and put it in the cache directory if it wasn't
already there -- and then give me the path and filename to the image in the
cache. It was important to have one controlling function (or method) where
the image was either pulled from the database and named and the cached image
reference was returned.

One cool thing about this approach is that there is no problem with deleting
all the files in the cache periodically, because they will just get created
as needed. Is suprisingly fast, too. I was actually surprised at how well
this approach worked. I had tried some other much more complex solutions,
but all of them had issues with either speed, debugging, or ease of use in
my applications. I use this approach now in every application (winforms and
web forms) that I do where I need dynamic images.

The one downside is that animated gifs don't survive the process without
becoming just static gifs. But that hasn't been a problem for me -- yet. The
other problem is that if there are security concerns, you will have to find
a way to lock down the image cache directory. This also has not been an
issue for me yet either.

This may not be the kind of solution you are looking for, but I hope it at
least gives you some ideas. Good luck!

-Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top