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

dynamic image woes

Explorer ,
Mar 02, 2009 Mar 02, 2009
hi again, I made your suggested corrections to my code and there are no error messages, however, no images display on the details page.
TOPICS
Getting started
998
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

correct answers 1 Correct answer

LEGEND , Mar 02, 2009 Mar 02, 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, the...
Translate
LEGEND ,
Mar 02, 2009 Mar 02, 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/
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
Explorer ,
Mar 02, 2009 Mar 02, 2009
It works !!! I changed the query to

SELECT thumb
FROM completeImages
WHERE projectID = <cfqueryparam cfsqltype="cf_sql_integer"
value="#url.projectID#">

and I changed the link to: &projectID=#cool.projectID#"


I am trying to dispaly an images unavailabe message if there are no images in the database. pls see code.

<cfoutput query="coolpicx">
<cfif #thumb# EQ " ">

<img src="/crabweb1a/Images/CompleteProjectImages/completeThmbs/#thumb#"/>
<cfelse>
Images unavailable
</cfif>
</cfoutput>
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 ,
Mar 02, 2009 Mar 02, 2009
rockhiker wrote:
> <cfif #thumb# EQ " ">


<cfif thumb EQ "">

No data in a field will be an empty string not a single space character.
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 ,
Mar 02, 2009 Mar 02, 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/
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
Explorer ,
Mar 03, 2009 Mar 03, 2009
LATEST
thank yous - I will give that a try.
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