Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

showing the images

New Here ,
Aug 20, 2008 Aug 20, 2008
Hi.I need to show the images wich are in folder images & display "No Image" for those we have not the image in the folder.
I wrote this code:

<cfset PhotoLocation =
"e:\www\NeedBattery\images\manufacturer\<cfoutput>#getBrands.cat_level2_image#</cfoutput>">
<cfif not FileExists(PhotoLocation)>
<cfoutput>no image</cfoutput>
<cfelse>
<a><img src="#imagePath#images/manufacturer/#getBrands.cat_level2_image#" width="60" height="40" /></a>
</cfif>

but the result is incorrect & typed "NO Image" for all the images.
would u plz help me what is wrong with my code?
thanks
283
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 20, 2008 Aug 20, 2008
I generally troubleshoot my if/else problems like this.

<cfif the variable is what I expect it to be>
true
<cfelse>
output or dump the variable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 20, 2008 Aug 20, 2008
Try
<cfif FileExists(ExpandPath("\NeedBattery\images\manufacturer\<cfoutput>#getBrands.cat_level2_image#</cfoutput>"))>

If you still want to use the PhotoLocation you need to amend thus:
<cfset PhotoLocation =
"\NeedBattery\images\manufacturer\<cfoutput>#getBrands.cat_level2_image#</cfoutput>">
<cfif FileExists(ExpandPath(PhotoLocation))>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 20, 2008 Aug 20, 2008
LATEST
thanks for reply,but still I get the same result.No Image for all images.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources