Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Sure. Post the code, some example data, and the rendered html.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I suspect you are right. Both tables use a field that references a path relative to the root directory. The odd thing was that one works while the other (with repeating range) displays some info correctly and other ingo it does not due to appending the subfolder.
How do I "globally" apply the change to use site root relative paths?
Copy link to clipboard
Copied
Can you please show us some example data (paths) from the database for both the working and non-working section? I suspect the good one uses site root relative path and the bad does not. Site root relative paths start with a '/'.
Copy link to clipboard
Copied
They both use the same connection for the recordset. (I think that is what you are referring?)
MM_EiNews_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath ("/data/xxxxx.mdb")
They sre just different recordsets using data from different tables
Copy link to clipboard
Copied
No, that's not what I am asking. Please give us an example of the DATA stored in the database tables. That's where the problem is.
Copy link to clipboard
Copied
images/ProdServ/booster.jpg |
images/ProdServ/watertreat.jpg |
images/ProdServ/watertest.jpg |
images/ProdServ/pws.jpg |
images/ProdServ/watertest.jpg |
images/ProdServ/wellpumps.jpg |
images/ProdServ/cpp4web.jpg |
images/ProdServ/stdwell.jpg |
images/ProdServ/sanitarywell.jpg |
images/ProdServ/ecogood.jpg |
images/ProdServ/3500.jpg |
images/ProdServ/etf2100.jpg |
images/ProdServ/ERO350.jpg |
Copy link to clipboard
Copied
Those are doc relative paths, so of course they will break if the path of the document changes. You need to update those to be site root relative links - then they will work from anywhere in the site. Just do a mass update to add the "/".