Skip to main content
August 28, 2009
Question

Trying to get an image to display

  • August 28, 2009
  • 2 replies
  • 1026 views

Using the following query. I'm able to pull information from two tables and it's working

<cfparam name="PageNum_rsGetProducts" default="1">
<cfquery name="rsGetProducts" datasource="laurie">
SELECT product_ID, product_MerchantProductID, product_Name, product_Description, product_ShortDescription, prdctImage_ProductID, prdctImage_FileName
FROM dbo.tbl_products, dbo.tbl_prdtImages
WHERE product_ID = prdctImage_ProductID
ORDER BY product_Name
</cfquery>
<cfset MaxRows_rsGetProducts=10>
<cfset StartRow_rsGetProducts=Min((PageNum_rsGetProducts-1)*MaxRows_rsGetProducts+1,Max(rsGetProducts.RecordCount,1))>
<cfset EndRow_rsGetProducts=Min(StartRow_rsGetProducts+MaxRows_rsGetProducts-1,rsGetProducts.RecordCount)>
<cfset TotalPages_rsGetProducts=Ceiling(rsGetProducts.RecordCount/MaxRows_rsGetProducts)>

This is the HTML

<body>
<table border="1">
  <tr>
    <td>product_ID</td>
    <td>product_MerchantProductID</td>
    <td>product_Name</td>
    <td>product_Description</td>
    <td>product_ShortDescription</td>
    <td>pic </td>
  </tr>
  <cfoutput query="rsGetProducts" startRow="#StartRow_rsGetProducts#" maxRows="#MaxRows_rsGetProducts#">
    <tr>
      <td>#rsGetProducts.product_ID#</td>
      <td>#rsGetProducts.product_MerchantProductID#</td>
      <td>#rsGetProducts.product_Name#</td>
      <td>#rsGetProducts.product_Description#</td>
      <td>#rsGetProducts.product_ShortDescription#</td>
      <td><img src="#rsGetProducts.prdctImage_FileName#" /></td>
    </tr>
  </cfoutput>
</table>
</body>
</html>

However, the iamge doesn't display. All I get is the x. I went into DW and bound it to img.src and it's still not working - how can I get this to work

This topic has been closed for replies.

2 replies

Cyril Hanquez
Participating Frequently
September 25, 2009

Just output #rsGetProducts.prdctImage_FileName# to display the path returned and check again the location of the picture.Maybe a / is missing (absolute vs relative path) or something like that...

August 28, 2009

Some things for you to check:

  • does the image exist in the location referred to by the retrieved link?
  • was the image created as RGB rather than CYMK?

In general, you'll want all your images in a specific directory.