我正在尝试使用cfmail
从数据库存储的路径向实际图像插入或嵌入图像到电子邮件中。实际的JPEG图像存储在名为“images_personnel”的文件夹中。标题为photopath
的列下的图像路径作为/file/images_personnel/28.jpg
存储在我的数据库表中。在屏幕上显示图像时没有问题,将同一图像作为cfloop
查询的一部分嵌入不会将图像插入/嵌入到电子邮件中。相同cfloop
的所有其他输出显示和电子邮件都很好。但是每个人的照片都没有显示出来。我做错了什么?
我的代码如下:
<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>