Skip navigation
Currently Being Moderated

Inserting or embed and image into cfmail output from a database-stored path to an actual image.

Nov 5, 2013 5:28 AM

Tags: #html #table #coldfusion #cfmail

I am trying to insert or embed and image into cfmail from a database-stored path to an actual image. The actual JPEG image is stored in a folder called "images_personnel". The path to the image under the column titled photopath is stored in my database table as "/file/images_personnel/28.jpg". Displaying the image on the screen renders without a problem, embedding the same image as part of a cfloop query does not insert/embed the image into an email. All of the other output of the same cfloop displays and emails just fine. However none of the photos of each personelle show up. What an I doing wrong?

My code is below:

<cfquery name="Staffreport" datasource="master">
Select staffreport.*, name.personnelid, name.email, name.last, name.noiid, stafflt, CONCAT(name.fname,' ',name.middle,' (',name.last,')') AS teammember, CONCAT(name.fname,' ',name.middle) AS teammember2, concat(name.photopath,'',name.photo)as hisphoto, stafflt.*, trim(concat(ltfname,' ',ltmiddle)) as LT from Staffreport, name, stafflt
where 0=0
and stalt = '#Session.user_id#'
and ltid = '#session.user_id#'
and staweekbegin =
<cfqueryparam value="#form.staweekbegin#" cfsqltype="cf_sql_date" />
AND staweekend =
<cfqueryparam value="#form.staweekend#" cfsqltype="cf_sql_date" />
AND stapersonnelid = personnelID
<!---AND ltid = stalt--->
AND CITY = 'richmond'
AND STATUS <> 'd'
AND STATUS <> 'T'
AND type = 'personnel'
Group by personnelid
Order by teammember

</cfquery>
<cfmail>...
<cfloop query="staffreport"><br />
<table width="90%" border="0" cellspacing="2" cellpadding="4" align="left">
 
<tr>
   
<td colspan="2" align="center" valign="top" nowrap="nowrap" bgcolor="cccccc"><strong><font color="black"><cfif #staffreport.last# eq ".">#Ucase(Staffreport.teammember2)# <cfelse>#Ucase(Staffreport.teammember)#</cfif> - ID: <cfoutput>#Staffreport.noiid#</cfoutput></font></strong></td>
 
</tr>
<tr>
   
<td align="left" valign="top" nowrap="nowrap" bgcolor="#000000">Name:</td>
   
<td>#Staffreport.teammember#</td>
 
</tr>
<tr>
   
<td bgcolor="E6E1FD">Photo:</td>
   
<td bgcolor="EBEBEB">
<img src="#staffreport.hisphoto#" alt="Photo" width="98" height="98">
</td>
 
</tr>
<tr>
   
<td bgcolor="E6E1FD">Email:</td>
   
<td bgcolor="EBEBEB">#staffreport.email#</td>
 
</tr>
</table>
</cfloop>
</cfmail>

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points