Skip to main content
February 16, 2012
Question

Image source in .asp page

  • February 16, 2012
  • 1 reply
  • 1567 views

I have an asp page with 2 sets of data. Both data sets comtaing image paths so I can display and amage along side the description

I moved the page to a subfolder (to organize it better) and the data and images still diaplay fine from the one data set but the other data set is appending the subfolder to the image source path. If I display the data as text is displays fine but if I use it as an image source it will show the image on some records but append the subfolder to the others

Can anyone help

This topic has been closed for replies.

1 reply

Participating Frequently
February 16, 2012

Sure. Post the code, some example data, and the rendered html.

February 16, 2012

Here is a link to the page, I put the image data in there also as text

I'm not a "code" person so I'm not sure what to send, is this good?

Application</a></p>

      <p align="center">800-360-0660<br />

      </p>

    </td>

    <td height="468" colspan="4" align="left" valign="top" bordercolor="#ECE9D8" bgcolor="#FFFFFF"><!-- InstanceBeginEditable name="EditRegion3" -->

    <table width="688" border="0" align="center" cellpadding="0" cellspacing="2">

      <tr bgcolor="#FFFFFF">

        <td width="274" height="511" valign="top"><table width="405" border="0" align="center" cellpadding="0" cellspacing="0">

          <tr>

            <th height="28" colspan="2" bgcolor="#B1C3D9" scope="col">Products & Services </th>

          </tr>

          <%

While ((Repeat1__numRows <> 0) AND (NOT rsProdServ.EOF))

%>

          <tr>

            <td width="360" bgcolor="#FFFFFF"><p><strong><%=(rsProdServ.Fields.Item("PSTitle").Value)%></strong><br />

              <%=(rsProdServ.Fields.Item("PSDesc").Value)%><br />

              <br />

              <%=(rsProdServ.Fields.Item("PSPhoto").Value)%><br />

            </p></td>

            <td width="45" align="center" valign="middle" bgcolor="#FFFFFF"><p><img src="<%=(rsProdServ.Fields.Item("PSPhoto").Value)%>" alt="Services" width="35" /><br />

              </p></td>

          </tr>

          <%

  Repeat1__index=Repeat1__index+1

  Repeat1__numRows=Repeat1__numRows-1

  rsProdServ.MoveNext()

Wend

%>

        </table>

          <div align="center"></div>

          <p> </p>

          <div align="center"></div></td>

        <td width="408" align="center" valign="top" bordercolor="#000000"><div align="center">

          <p> </p>

        </div>

          <div align="center"><img src="../Images/env.JPG" width="231" height="305" alt="Environmental site" /></div>

          <div align="center">

            <p> </p>

            <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">

              <tr>

                <td width="59" rowspan="2" align="left" valign="top"><h5><img src="<%=(rsNews.Fields.Item("newsphoto").Value)%>" alt="" width="60" /><br />

</h5></td>

                <td width="240" align="center" bgcolor="#00FFFF">Latest News</td>

              </tr>

              <tr>

                <td align="left"><strong><%=(rsNews.Fields.Item("Headline").Value)%> - </strong><%=(rsNews.Fields.Item("newsdte").Value)%>                  <p> </p></td>

              </tr>

              <tr>

                <td colspan="2" align="center" valign="middle"><%=(rsNews.Fields.Item("Story").Value)%></td>

              </tr>

            </table>

            <p><br />

            </p>

          </div></td>

      </tr>

    </table>

    <p> </p>

    <p align="center"> </p>

<div align="center"><br />

 </div>

    <!-- InstanceEndEditable --></td>

  </tr>

  <tr>

    <td colspan="5" bgcolor="#C0DFFD"> </td>

  </tr>

</table>

</body>

<!-- InstanceEnd --></html>

<%

rsProdServ.Close()

Set rsProdServ = Nothing

Participating Frequently
February 16, 2012

OK, your code contains two dynamic images:

img src="<%=(rsProdServ.Fields.Item("PSPhoto").Value)%>

and

<img src="<%=(rsNews.Fields.Item("newsphoto").Value)%>"

Which is having the problem? Give us an example of the data stored in these two fields. I'm guessing you are using document relative paths for the images in your data. This will be problematic. Use site root relative paths instead.