Copy link to clipboard
Copied
Good Morning,
I have a situation, i have a folder in my web directory that has subfolders and more subfolders. Each image folder represents a product catagory and the subfolder within the catagory folder represents image subcatagories. for example The Hats folder have subfolders or subcatagories entitled caps, beret, tams, etc. The Scarves folder has subfolders or subcatagories entitled neck_scarf, head_scarf, Shoulder_scarf etc. My mysql database only stores the text file path i.e. /image/Categories/Hats/Caps/item 6.JPG or /image/Categories/scarves/neck_scarves/item23.JPG. Whenever i try to cfoutput the image filepath within an image placeholder in dreamweaver it works just fine rendering the image catagory/subcatagory on some pages but do not display images from other catagories/subcatagories on other pages. Is there a standard way to output images? Below is the syntax illustrating what I'm using...
<img src="<cfoutput>./#product.proimage#</cfoutput>" alt="" name="proimage" width="358" height="477" class="whiteBorder" />
<cfoutput><img src="./#product.proimage#" alt="" name="proimage" width="186" height="247" /></cfoutput>
Copy link to clipboard
Copied
Are you saying that the picture displays in one <cfoutput> block but not another ON THE SAME PAGE? Or that they display on one page and not the other? If its the latter, think about how you are pointing to the location of your images. particularly this part:
College Kid wrote:
./#product.proimage#
This path will naturally point to different places depending on what page you are on. Your best bet is to store the path of your graphic from the web root instead of a relative path from the current directory. If you dump out the full path you are trying to write to your screen and copy/paste it into your browser if should be come apparent if you have an addressing error with how you are forming your image paths.
Not sure if its appropriate, but <cfdirectory> might be a good thing to check out - you can use that to quickly and dynamically index your subdirectories so you can pull right from the directory structure instead of storing your paths in the database.
Copy link to clipboard
Copied
the syntax ./#product.proimage# is the same for both the displayed and non-displayed images. however when some images located in different subfolders are being call via the database stored file path it does not show up.
Copy link to clipboard
Copied
The syntax
./#product.proimage#
Is telling the web browser to go up a directory from the current directory and then evaluate the path contained in the CF variable:
example (based on the paths in your example)
.//image/Categories/scarves/neck_scarves/item23.JPG
comes from:
prefix hardcoded into HTML: ./
URL from database: /image/Categories/scarves/neck_scarves/item23.JPG
This tells the web browser, starting on in the current directory, go up one directory, look for a directory called "image" and travel down the directory tree from there. Because this is a relative path (not an absolute path), the place that the browser may be looking for this image will differ depending on the location of the page that contains the image tag.
I recommend that you dump out the SRCs that you are trying to generate on the pages that don't seem to be working and see if you can tell what is wrong with the URL path.
Copy link to clipboard
Copied
It sounds like you have an issue with your paths to the image, do you have a url on the internet that we can go to?
The position of your <cfoutput> tags should not matter, inside the img tag will work, also outside the img tag will work as well.
Check the source of the page from your web browser and see if the correct paths are being included in the img tag. It looks like you are using absolute paths, absolute paths always start with / and should be the full image path from root directory to the directory containing the image.
Hope this helps.
Michael Workman