-
1. Re: Dynamically give a name to cfimage
BKBK May 25, 2014 1:22 AM (in response to College Kid)You should set the source attribute dynamically, rather than the name attribute. Get its value, the image path linked to a particular product, from a database query.
-
2. Re: Dynamically give a name to cfimage
College Kid May 25, 2014 6:00 AM (in response to BKBK)Thanks for the reply. The image source="C:\ColdFusion9\wwwroot\shotthp\#product.proimage#" is set dynamically. As the #product.proimage# finishes the path to the actual images Which some are in different folders.
The image path is actually "C:\ColdFusion9\wwwroot\shotthp\image\source\hats\caps\photo24.jpg" as is the next image should point to "C:\ColdFusion9\wwwroot\shotthp\image\source\hats\caps\dcs_45.jpg" which normally displays a different image But the page is displaying the same image in each thumbnail.
-
3. Re: Dynamically give a name to cfimage
BKBK May 25, 2014 7:54 AM (in response to College Kid)Assuming that 'product' is the name of the query that contains the path of the image of each product, then you could just use cfoutput. I have assumed in the following that each row in the result-set corresponds to a specific product.
<cfoutput query="product">
<!--- In what follows, myImage is the dynamic name for the image corresponding to each row --->
<cfimage source="C:\ColdFusion9\wwwroot\shotthp\#product.proimage#" name="myImage">
<!--- Turn on antialiasing. --->
<cfset ImageSetAntialiasing(myImage)>
<cfset ImageScaleToFit(myImage,182,"","highestPerformance")>
<!--- More code pertaining to each row, hence to each product. For example, create the folder, scaledProductImages, beforehand and store the edited images for later use --->
<cfimage source="#myImage#" action="write" destination="C:\ColdFusion9\wwwroot\shotthp\scaledProductImages\#product.proimage#" overwrite="yes">
</cfoutput>

