Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
Please paste the exact HTML generated.
Copy link to clipboard
Copied
You'll need to provide a full URL link to the image ("http://mywebserver/file/images_personnel/28.jpg"), not just a relative path. Remember, the email client that is used to view the email content knows nothing of the internals of your web server - it can only follow a complete URL to get images and other resources.
-Carl V.