Loading image files

Results 1 to 5 of 5

Thread: Loading image files

  1. #1
    Join Date
    Dec 1969
    Posts
    36

    Default Loading image files

    How can I get the images to actually show up where the file names are? The page is http://www.agora-gallery.com/aspTest.asp<BR><BR>Thanks<BR>Ariel<BR>this is the code:<BR>&#060;html><BR><BR>&#060;head><BR>&#060;t itle>Test.asp&#060;/title><BR>&#060;/head><BR><BR>&#060;body bgcolor="#FFFFFF"><BR>&#060;% <BR>set conntemp=server.createobject("adodb.connection")<B R><BR>&#039 DSNless connection to Access Database<BR>DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "<BR>DSNtemp=dsntemp & "DBQ=" & server.mappath("Gallery.mdb")<BR>conntemp.Open DSNtemp<BR>&#039 DSNless connection to Access Database<BR><BR>set rstemp=conntemp.execute("select * from Picture where Pt_Theme=&#039Abstract&#039")<BR>&#039 set rstemp=conntemp.execute("select * from Picture where Pt_Designer LIKE &#039W%&#039")<BR>howmanyfields=rstemp.fields.coun t -1<BR>&#037;&#062;<BR><BR>&#060;table border="1"><BR> &#060;tr><BR>&#060;% &#039Put Headings On The Table of Field Names<BR>for i=0 to howmanyfields &#037;&#062;<BR> &#060;td>&#060;b>&#060;%=rstemp(i).name &#037;&#062;&#060;/b>&#060;/td><BR>&#060;% next &#037;&#062;<BR> &#060;/tr><BR>&#060;% &#039 Now lets grab all the records<BR>do while not rstemp.eof &#037;&#062;<BR> &#060;tr><BR>&#060;% for i = 0 to howmanyfields&#037;&#062;<BR> &#060;td valign="top">&#060;%=rstemp(i)&#037;&#062;<BR>&#06 0;/td><BR>&#060;% next &#037;&#062;<BR> &#060;/tr><BR>&#060;% rstemp.movenext<BR>loop<BR>rstemp.close<BR>set rstemp=nothing<BR>conntemp.close<BR>set conntemp=nothing&#037;&#062;<BR>&#060;/table><BR>&#060;/body><BR>&#060;/html>

  2. #2
    Join Date
    Dec 1969
    Posts
    35

    Default RE: Loading image files

    Okay the problem is that you&#039re not telling the browser to actually load the images when it requests the page. In the loop:<BR>&#060;%for i=0 to howmanyfields&#037;&#062;<BR>&#060;td valign="top">&#060;%=rstemp(i)&#037;&#062;<BR>&#06 0;/td><BR>&#060;%next&#037;&#062;<BR>Include the &#060;img> tags so that the browser actually knows to load the images. I&#039m going to assume that all of the images are in a sub directory called images. Then write the loop like this:<BR>&#060;%for i=0 to howmanyfields&#037;&#062;<BR>&#060;td valign="top">&#060;img scr="images/&#060;%=rstemp(i)&#037;&#062;" alt="(whatever)" width="(width)" height="(height)"><BR>&#060;/td><BR>For the ease of programming I&#039d use the same size pictures for this table (ie thumbnails) so that the width and height can be hardcoded. Good Luck, and Happy Programming =)

  3. #3
    Ian Stalings Guest

    Default RE: Loading image files

    when you do the loop instead of this:<BR>&#060;b>&#060;%=rstemp(i).name &#037;&#062;&#060;/b><BR><BR>use this:<BR>&#060;img src="images/&#060;%=rstemp(1).name&#037;&#062;"><BR><BR>of course you wouls have to change "images/" to what<BR>ever the correct path is.<BR><BR>hope this helps.

  4. #4
    Join Date
    Dec 1969
    Posts
    36

    Default Loading image files - Part II

    I made the changes http://www.agora-gallery.com/AspTestPart2.asp<BR>but now all the rest of the data is gone..<BR>what to do?<BR>Thanks<BR>Ariel<BR><BR>This is the new code<BR>&#060;html><BR><BR>&#060;head><BR>&#060;ti tle>Test.asp&#060;/title><BR>&#060;/head><BR><BR>&#060;body bgcolor="#FFFFFF"><BR>&#060;% <BR>set conntemp=server.createobject("adodb.connection")<B R><BR>&#039 DSNless connection to Access Database<BR>DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "<BR>DSNtemp=dsntemp & "DBQ=" & server.mappath("Gallery.mdb")<BR>conntemp.Open DSNtemp<BR>&#039 DSNless connection to Access Database<BR><BR>set rstemp=conntemp.execute("select * from Picture where Pt_Theme=&#039Abstract&#039")<BR>&#039 set rstemp=conntemp.execute("select * from Picture where Pt_Designer LIKE &#039W%&#039")<BR>howmanyfields=rstemp.fields.coun t -1<BR>&#037;&#062;<BR><BR>&#060;table border="1"><BR> &#060;tr><BR>&#060;% &#039Put Headings On The Table of Field Names<BR>for i=0 to howmanyfields &#037;&#062;<BR> &#060;td>&#060;b>&#060;%=rstemp(i).name &#037;&#062;&#060;/b>&#060;/td><BR>&#060;% next &#037;&#062;<BR> &#060;/tr><BR>&#060;% &#039 Now lets grab all the records<BR>do while not rstemp.eof &#037;&#062;<BR> &#060;tr><BR>&#060;% for i = 0 to howmanyfields&#037;&#062;<BR> &#060;td valign="top">&#060;img src="gallery/&#060;%=rstemp(i)&#037;&#062;" alt="No Image File" width="60"<BR> height="110"> &#060;/td><BR>&#060;% next &#037;&#062;<BR> &#060;/tr><BR>&#060;% rstemp.movenext<BR>loop<BR>rstemp.close<BR>set rstemp=nothing<BR>conntemp.close<BR>set conntemp=nothing&#037;&#062;<BR>&#060;/table><BR>&#060;/body><BR>&#060;/html><BR>


  5. #5
    Join Date
    Dec 1969
    Posts
    35

    Default RE: Loading image files - Part II

    Okay, what looks like is happening is that the headings are being pulled just fine, but when we do the for loop inside the while loop all of the entries are trying to be read as images. But according to the first page, only two of the columns are actually pictures. So what you may have to do is increase the inner for loop to include each entry in the record. Something like this:<BR>&#060;%do while not rstemp.eof&#037;&#062;<BR>&#060;tr><BR>&#060;td>&# 060;%=rstemp(pt_id)&#037;&#062;&#060;/td><BR>&#060;td>&#060;%=rstemp(pt_Designer)&#037;& #062;&#060;/td><BR>[more code as appropriate]<BR>&#060;td>&#060;img src="gallery/&#060;%=rstemp(pt_filename)&#037;&#062;" alt="no image file" width=60 height=110>&#060;/td><BR>&#060;td>&#060;img src="gallery/&#060;%=rstemp(pt_filenamel)&#037;&#062;" alt"no image file" width=60 height=110>&#060;/td><BR>[more code as appropriate]<BR>&#060;/tr><BR>&#060;%rstemp.MoveNext<BR>loop<BR>[etc.]<BR>&#037;&#062;<BR>See if that doesn&#039t work for you. Because what looks like is happening is that for every entry in your datasase the browser is looking for an image file to fill into each cell in the table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •