Forums
 This topic is locked 
             Show picture from db source
 Posted 08 Oct 2004  16:57:11 
  1 
     has   voted 
  08 Oct 2004  16:57:11 Christian Sen posted: 
 Hi there!I'm trying to make a dynamic userpage where I want to show a picture of the logged-in user.
I've tried to do this several ways, but with no luck.
It always ends up with some sort of VBscript runtime error..
In my simple world all I had to do to make this work was to add a column in the db
with ref to a picture on the server (hyperlink).
Any ideas?
Regards, Sarre
Let's face it, designing is fun. Coding....not so fun.
Replies
 Replied 08 Oct 2004  18:09:46 
   08 Oct 2004  18:09:46 Rene Bandsma replied: 
  When you don't store your path in your database use something like this:
<pre id=code><font face=courier size=2 id=code>
<img src="photo/<%=(recordset.Fields.Item("photo" .Value)%>">
.Value)%>">
</font id=code></pre id=code>
When you have stored the path in your database you have to use this instead:
<pre id=code><font face=courier size=2 id=code>
<img src="<%=(recordset.Fields.Item("photo" .Value)%>">
.Value)%>">
</font id=code></pre id=code>
  <pre id=code><font face=courier size=2 id=code>
<img src="photo/<%=(recordset.Fields.Item("photo"
 .Value)%>">
.Value)%>"></font id=code></pre id=code>
When you have stored the path in your database you have to use this instead:
<pre id=code><font face=courier size=2 id=code>
<img src="<%=(recordset.Fields.Item("photo"
 .Value)%>">
.Value)%>"></font id=code></pre id=code>
 Replied 09 Oct 2004  02:19:41 
   09 Oct 2004  02:19:41 Christian Sen replied: 
  Thank you Bandsma!
Your tip absolutely did the trick!
Regards, Sarre
  Your tip absolutely did the trick!
Regards, Sarre
 Replied 09 Oct 2004  02:29:50 
   09 Oct 2004  02:29:50 Christian Sen replied: 
  Just one last question, though.
The page does not seem to filter the pictures, it shows only pic nr 1 in the list.
I'm guessing the error is in the DW recordset.
Any suggestions?
I have the pics in a folder under ../pics/users/pic01.jpg etc..
The designated picture for the logged in user is in a column named foto.
 
  The page does not seem to filter the pictures, it shows only pic nr 1 in the list.
I'm guessing the error is in the DW recordset.
Any suggestions?
I have the pics in a folder under ../pics/users/pic01.jpg etc..
The designated picture for the logged in user is in a column named foto.
 Replied 09 Oct 2004  13:56:28 
   09 Oct 2004  13:56:28 Rene Bandsma replied: 
  When you are using the standard User Authenticaion server behaviors of Dreamweaver then you have to filter your recordset on MM_username. 
   Replied 11 Oct 2004  03:01:38 
   11 Oct 2004  03:01:38 Christian Sen replied: 
  I've tried adding Foto-session to the login page, as regard to the Foto-column i the db,
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username" = MM_valUsername
 = MM_valUsername
Session("Foto" = MM_rsUser("Foto"
 = MM_rsUser("Foto"
..but with no luck.
 
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username"
 = MM_valUsername
 = MM_valUsernameSession("Foto"
 = MM_rsUser("Foto"
 = MM_rsUser("Foto"
..but with no luck.
 Replied 11 Oct 2004  20:35:51 
   11 Oct 2004  20:35:51 Rene Bandsma replied: 
  I think you should set it to your RecordSet Id. 
   Replied 12 Oct 2004  00:05:58 
   12 Oct 2004  00:05:58 Christian Sen replied: 
  I found a way:
Just did a response.write to the <font color=blue>Session("Foto" = MM_rsUser("Foto"
 = MM_rsUser("Foto" </font id=blue>
</font id=blue>
Worked like a charm, thanx for helping me along, Bandsma! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Regards, Sarre
 
  Just did a response.write to the <font color=blue>Session("Foto"
 = MM_rsUser("Foto"
 = MM_rsUser("Foto" </font id=blue>
</font id=blue>Worked like a charm, thanx for helping me along, Bandsma! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Regards, Sarre
 Replied 27 Mar 2013  04:27:56 
   27 Mar 2013  04:27:56 Greta Garberini replied: 
  Could not get it to work in php. My code is something like
 
  
