Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 **Displaying Imgs| Please Help**
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

asp_storm
Average Member

USA
787 Posts

Posted - 24 August 2001 :  14:09:31  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
i am writing a picture upload script and was wondering how
you would display an image out of a
database. i can display text fine. any help id

greatly appreciated!
p.s.
herez what i have so far:
<% 
Response.Write "<html>" & vbCrLf & _
"<head><title>Test DB Script</title></head>" & vbCrLf & _
"<body>" ' <--- Your code was missing this for sure....

Set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "D:/Database/pics.mdb"
Set rs = Server.CreateObject("ADODB.recordset")

rs.Open "Select ID, Pic_Id, Pic_Taker, Pic_Other, Pic_Url from pic", conn
' Check for EOF or BOF first
If rs.EOF or rs.BOF then
' Do nothing - no records found
else
Do until rs.EOF
For Each x In rs.Fields
Response.Write x.name & "=" & x.value & "<br />" & vbCrLf
Next
rs.MoveNext
Loop
end if
rs.close
set rs = nothing

conn.close
Response.Write "</body>" & vbCrLf & "</html>" & vbCrLf
%>



¦_____________Creator___Of___________¦
[-------------Newschoolskiing.com-------------]


Edited by - asp_newbie on 24 August 2001 14:10:10

JohnIII
New Member

United Kingdom
52 Posts

Posted - 24 August 2001 :  16:51:08  Show Profile  Visit JohnIII's Homepage
If you have Pic_URL in the DB have you uploaded the image or just the address?

To display the image, read http://www.4guysfromrolla.com/webtech/060100-1.shtml .

John III
Go to Top of Page

james1415
Starting Member

1 Posts

Posted - 24 August 2001 :  17:44:24  Show Profile  Send james1415 an ICQ Message
What I do is put the <IMG SRC=theimage.jpg> Just put the code and put where the image is. It works for me...

Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 24 August 2001 :  20:35:24  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
k, thx, i almost got it


¦_____________Creator___Of___________¦
[-------------Newschoolskiing.com-------------]
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 28 August 2001 :  13:33:28  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
ok, i tried this:


<%
Set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "D:/mysites/db/Database/gallery.mdb"
'---
%>
<%
Set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select Pic_Url from Pictures", conn
%><table border="1" width="100%">
<%Do Until rs.EOF%>
<tr>
<%For Each x In rs.Fields%>
<td><img src=<%=x.value%></td>
<%Next
rs.MoveNext%>
</tr>
<%Loop
rs.close
conn.close
%>
</table>


and it displays the image placeholder, but for the 'src' of the img it gives the right path, BUT then it adds a '#' and re-does the path


¦_____________Creator___Of___________¦
[-------------Newschoolskiing.com-------------]


Edited by - asp_newbie on 28 August 2001 13:44:56
Go to Top of Page

Craig from Alberta
Starting Member

Canada
7 Posts

Posted - 28 August 2001 :  17:45:13  Show Profile  Visit Craig from Alberta's Homepage
Check your data in the database. The # is indicative of a bookmark. It must be coming from somewhere.

Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 28 August 2001 :  19:05:37  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
i did and everything checked out


¦_____________Creator___Of___________¦
[-------------Newschoolskiing.com-------------]
Go to Top of Page

sogoth
New Member

United Kingdom
73 Posts

Posted - 29 August 2001 :  07:03:41  Show Profile  Visit sogoth's Homepage
heya
I'm doing something similar at the moment. All I'm doing is adding the image name to the database, uploading the image to a directory called covers and placing the following line whenever I want the image called by the recordset to appear...

<img src="covers/<%= (rsrev("cover"))%>" width="130" height="130">

it seems to work :)
now all I need to do is work out how I can get the database to scan a directory and input all the names automatically... typing in the names of 3000 photos is going to be a complete git!

Paul -
Complete Muppet, Borderline Feeble!
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 29 August 2001 :  09:22:48  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
thx,will try:)


¦_____________Creator___Of___________¦
[-------------Newschoolskiing.com-------------]
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 29 August 2001 :  18:53:32  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
yea, how would you do that?


¦_____________Creator___Of___________¦
[-------------Newschoolskiing.com-------------]
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 29 August 2001 :  20:06:24  Show Profile
Using file system object!

Think Pink
Test Site & Guidelines | DL Post v40b02 Files
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 30 August 2001 :  21:35:21  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
explain,,


¦_____________Creator___Of___________¦
[-------------Newschoolskiing.com-------------]
Go to Top of Page

big9erfan
Average Member

540 Posts

Posted - 31 August 2001 :  03:42:21  Show Profile
I use this function to display ( in a textbox ) all jpg or gif files from a given directory

Function ListOrGetPict( bIsNew )
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Dim objFolder
Dim strCurrentFolder

strCurrentFolder = "c:\directoy\images\"

Set objFolder = objFSO.GetFolder(strCurrentFolder)
strGetPictListings = ""

'Now, use a for each...next to loop through the Files collection
For Each objFile in objFolder.Files
'Check to see if objFile is pict file
If Right(objFile.Name, 4) = ".gif" then
'Print out the violating file name and location
strGetPictListings = strGetPictListings & "<option value='/PartOfURL/images/" & ObjFile.Name & "'>" & ObjFile.Name & "</option>" & vbCrLf
End if

if Right(objFile.Name, 4) = ".jpg" then
'Print out the violating file name and location
strGetPictListings = strGetPictListings & "<option value='/PartOfURL/images/" & ObjFile.Name & "'>" & ObjFile.Name & "</option>" & vbCrLf
End if
Next

Set objFSO = Nothing
Set objFolder = Nothing

ListOrGetPict = strGetPictListings

end function
%>


http://www.ugfl.net/forums
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07