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

Replacing Unfounf Images

Explorer ,
Nov 08, 2006 Nov 08, 2006

Copy link to clipboard

Copied

Hi,

On my training site when i click an individules name to see there progress it takes me to my profiles.cfm. On this page there is a photo of the individule along with there details.
Not all induvidules have a photo uploaded, how can i get it to use a defult images if there is not a photo uploaded?

Please find my current coding below :-

<cfparam name="start" default="">

<cfquery name="profileImage" datasource="breeze" username="stamp-ro" password="coldfusion256">
SELECT DISTINCT dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID
FROM (dbo.PPS_SCOS JOIN dbo.PPS_TRANSCRIPTS ON dbo.PPS_SCOS.SCO_ID = dbo.PPS_TRANSCRIPTS.SCO_ID)
JOIN dbo.PPS_PRINCIPALS ON dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID = dbo.PPS_PRINCIPALS.PRINCIPAL_ID
WHERE dbo.PPS_PRINCIPALS.NAME LIKE '#start#'
</cfquery>

<cfoutput query="profileimage"> <img src="images/#profileImage.PRINCIPAL_ID#.png" width="100" height="125"> </cfoutput>


Thanks

Lee Duncan
TOPICS
Advanced techniques

Views

319

Translate

Translate

Report

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
Guest
Nov 08, 2006 Nov 08, 2006

Copy link to clipboard

Copied

What does profileImage.PRINCIPAL_ID contain if there is no image available? Null?

If so:
<CFIF profileImage.PRINCIPAL_ID IS "">
<IMG SRC="images/default.gif" WIDTH="100" HEIGHT="125">
<CFELSE>
<img src="images/#profileImage.PRINCIPAL_ID#.png" width="100" height="125">
</CFIF>

Votes

Translate

Translate

Report

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 ,
Nov 08, 2006 Nov 08, 2006

Copy link to clipboard

Copied

No all employess have a principal_id but some dont have a photo.

Votes

Translate

Translate

Report

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
Guest
Nov 08, 2006 Nov 08, 2006

Copy link to clipboard

Copied

So profileImage.RecordCount is always 1, correct?

Votes

Translate

Translate

Report

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 ,
Nov 08, 2006 Nov 08, 2006

Copy link to clipboard

Copied

LATEST
use a rewrite rule on your http server to check that image files exist and if they don't redirect to a blank image...

#i love apache so much
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^images/(.*)?\.png images/default.png [NC,L,T=image/png]

Votes

Translate

Translate

Report

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
Documentation