|
I can load the image to the database but cant retrieve it to display it in a web page.
|
|
|
many thanks who ever you are? it seem lots of work to read an image from a database. I will try the methods you suggested
|
|
|
hi rob...
second option :
in file test.html, put this code :-
<img src="/forum/image_id_1.html">
then, in same directory, make file image.asp
and put this code :-
<%
Response.ContentType = "image/gif"
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
id = Request.QueryString("id")
`checking the data exist or not
`Server Name=test
`SQL Server database name=test
cme = "DRIVER={SQL SERVER};SERVER=test;UID=sa;pwd=;DATABASE=test"
`field ImageItem is image datatype in SQL Server.
cmdsql = "SELECT ImageItem from EQUIPMENT WHERE id =`"&id&"`"
set rs = Server.CreateObject("adodb.Recordset")
rs.open cmdsql, cme
Response.BinaryWrite rs("ImageItem")
Response.End
%>
it works fine for me.
no DLL consider for this option.
feel free to visit http://www.vss.com.my
|
|
|
the problem with this method is it flushes out all your code.
|
|
|
from rob :
the problem with this method is it flushes out all your code.
my answer :
flushes !, what you mean by that.
as i`m concern, this method will be getting the image datatype
from SQL Server.
very practical code.
i`m using it until now.
|
|
|
Both of the previous replies will work for you. The component sounds nice, but many times you may not be allowed to install components to the server. Or maybe you are on a tight budget and so do without components when possible. In which case, the second method suggested is all you need. Here is an article that provides even more detail regarding the answer you already got. Part 2 is specifically what you are looking for.
Part 1 http://www.superdotnet.com/show_article.aspx?pkID=81
Part 2 http://www.superdotnet.com/show_article.aspx?pkID=83
I can`t find Part 3, which I`d love to get my eyes on!
|
|
|
|
|
Hi there,
Is it possible to put an image into the database in a similar way?
Thanx!
|
|
|
|
|
I just wanted to follow up to say that most people don't store images in the database. Instead, they just store them in the filesystem as a normal file and only save information about the file in the database. It makes for simpler code, and there usually are not any performance reasons to store large binary chunks in the database. Plus, it allows you to work with your image files natively in the filesystem if you want/need.
|
|
|
|
|
I understand what you're saying but I'm particularly interested on this approach because we are about to develop an e-business web site to sell photos!
For security reasons this seems to be the best way to do it, don't you think?
|
|
|
hi dio,
why don't you try change the file content into binary format and keep it in binary field (database). then, you review it using code that can convert binary into image or whatever needed. I'm believe there is a way to do this but keep try and try. Hopefully you'll find it.
smile while programming.
<Added>
or,
maybe you can using PHP code because PHP code can help you on saving your record in database. However, I'm suggesting you make another database (MySQL) to store an image because it will make your main database (MS SQL) working more faster. If you store on same database, maybe it'll effect your main process and memory. Keep going to try it. You need to know various code other than ASP. Check it out PHP and MySQL. I'm sure it will help you to make e-portal/business.
Please make sure your IIS can support PHP compiler, check it out on IIS configure with PHP.
refer this link regarding on PHP and MySQL :-
http://www.atalasoft.com/products/imgxasp/docs/Database.html (Guide to insert image)
http://www.php.net (PHP Library/Source) http://www.mysql.com (MySQL Database) http://www.sqlyog.com (MySQL Control Interface) http://www.apache.org (HTTP Server) @ using IIS
GOOD LUCK.
|
|
|
dio, saving images to the filesystem rather than in a database does not present any security issues if done correctly. You can store all the images in directories that are outside the webroot. This way the images cannot be directly linked to. You can serve the images in your web pages using a script that you pass the filename to, then it reads the image server-side and streams back as an image.
I'm not saying DO NOT store in the database. I'm just saying that in my experience, I've found most people opt not to store them in the database. Honestly, I'm not sure of all the reasons why. It adds complexity to your application for one thing.
|
|
|
|
|
hey there,
I have already achieved what I wanted except for one thing, that is, save the image in the DB without using a third party component. Still, it seems this isn't possible on classic ASP.
thanx
|
|
|
Hello Yusairi,
Are you still around?
How did you get this script to work? Did this work without components? It seems like the easiest script for classic asp.
I tried using the script and did not have success.
Dreamweaver 8 is my current coding tool.
Please let me know if you are still with Codetoad.
|
|
|