Skip to main content
Inspiring
March 2, 2009
Answered

dynamic image woes

  • March 2, 2009
  • 1 reply
  • 960 views
hi again, I made your suggested corrections to my code and there are no error messages, however, no images display on the details page.
This topic has been closed for replies.
Correct answer Newsgroup_User
1) add <cfdump var="#cool#"> right after the query on page 3
2) check the query dump - did it return any data (images)?
if it did - the problem is with your code that displays the images, not
the query.
if it did not - check the value of projectID in the url - is it what you
expect it to be? (i have just guessed/assumed that #cool.projectID# on
your page 2 would be the correct projectID - maybe i was wrong?)
i have also assumed your projectID column is of type imteger/numeric -
if it is not, then change the cfsqltype to cerrect one in the
<cfqueryparam> tag...

if all else fails - post all relevant code from your page 3.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

1 reply

Newsgroup_UserCorrect answer
Inspiring
March 2, 2009
1) add <cfdump var="#cool#"> right after the query on page 3
2) check the query dump - did it return any data (images)?
if it did - the problem is with your code that displays the images, not
the query.
if it did not - check the value of projectID in the url - is it what you
expect it to be? (i have just guessed/assumed that #cool.projectID# on
your page 2 would be the correct projectID - maybe i was wrong?)
i have also assumed your projectID column is of type imteger/numeric -
if it is not, then change the cfsqltype to cerrect one in the
<cfqueryparam> tag...

if all else fails - post all relevant code from your page 3.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Inspiring
March 3, 2009
as Ian has mentioned, correct condition in your cfif should be:
<cfif thumb eq ""> or <cfif len(trim(thumb))>

but why don't you rather select only those records in your query that
have thumb to begin with? a lot more efficient to do it on db level than
checking each row at output...

depending on db you use, the function to use to check the length of
thumb column will be different. check you db manual for correct function
to use. the following will work in MySQL db:

<cfquery name="coolpicx" ...>
SELECT thumb
FROM ...
WHERE projectID = ... AND LENGTH(TRIM(thumb)) > 0
</cfquery>
<!--- or you could use CHAR_LENGTH(TRIM(thumb)) > 0 --->
<!--- just remember that these are DB functions, NOT cf functions! --->

that way your query will only select those records that do have a value
for THUMB. and you won;t need to do any checking at output. you can just do:

<cfoutput query="coolpicx">
<img src="/crabweb1a/Images/CompleteProjectImages/completeThmbs/#thumb#"/>
</cfoutput>
<cfif coolpicx.recordcount is 0>
No images to display, sorry...
</cfif>

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
rockhikerAuthor
Inspiring
March 3, 2009
thank yous - I will give that a try.