Skip to main content
New Participant
January 24, 2009
Question

Recall images

  • January 24, 2009
  • 1 reply
  • 237 views
Hi All,

I have two files
cw2/Assets/product_full [showing full image]
cw2/Assets/product_thumb [showing thumbnail images]

I am trying to get images from product_full.

How would I change this code so that I can recall the images from the file, dynamically?

<a href="cw2/Assets/product_full/abc_big.jpg ...</a>

Please find attached code.

Kindest regards
Adam
Newbie



Attach Code

<cfparam name="ImageRoot" default="cw2/Assets/product_thumb/">
<cfparam name="ImagePath" default="">
<cfparam name="ImageSRC" default="">
</cfsilent>

<cfprocessingdirective suppresswhitespace="yes">
<!--- ======================================================= --->
<!--- [ START ] DISPLAY PRODUCT --->
<cfif rsGetProduct.RecordCount NEQ 0>
<cfset ImageSRC = ImageRoot & rsGetProductImage.prdctImage_FileName>
<cfset ImagePath = ExpandPath(ImageSRC)>
<!--- Retrieve Associated SKU data --->
<cfquery name="rsGetSKUs" datasource="#request.dsn#" username="#request.dsnUsername#" password="#request.dsnPassword#">
SELECT tbl_skus.SKU_ID, tbl_skus.SKU_MerchSKUID, tbl_skus.SKU_Price,
tbl_skus.SKU_ProductID FROM tbl_skus WHERE tbl_skus.SKU_ProductID = #request.Product_ID#
AND SKU_ShowWeb = 1<cfif application.AllowBackOrders EQ 0> AND SKU_Stock <> 0</cfif> ORDER BY SKU_Sort
</cfquery>
<!--- Display Common Product data --->
<table id="tableProductDetails">
<tr>
<td width="414" height="293" valign="top">
<cfif FileExists(ImagePath)>


<a href="cw2/Assets/product_full/ktm_big.jpg" title="Image Detail" class="ZoomImage" rel="zoom-width: 400px; zoom-position: bottom">
<img src="<cfoutput>#ImageSRC#</cfoutput>" alt="<cfoutput>#rsGetProduct.product_Name#</cfoutput>"></a>



</cfif>
    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    January 24, 2009
    It is confusing when you call product_full and product_thumb 'files'. Aren't they directories?

    You also say nothing about the query rsGetProduct. It seems to play a part in the story.

    In any case I hope you will find something you can use in the following example. It lists the files contained in a folder called images within the current directory, that is, within the same directory as this CFM file. The filter attribute means Coldfusion must only list JPEGs. Setting recurse to no means Coldfusion should ignore directories within directories.