Unable to display image on cfdocument on the below...
# cfml-beginners
i
Unable to display image on cfdocument on the below code.
Copy code
<div><img src="../barcodeImages/#barCode.image#"></div>
Any help is highly appreciated.
Copy code
<cfdocument name="PaymentVoucher" format="pdf" >
			<h2 align="center">Payment Voucher</h2>
			<div style="margin-left:20px;">
			 
			To report contributions, submit this voucher ..............to:<br><br>
				<address>ABC Co<br>
						PO Box 123<br>
						Any City, VA 12349-0972<br>
				</address>
			</div>
			<cfoutput>
				<div style="margin-left:50px;">
					<br>
					<b>Voucher ID:</b><br>
					#Left(session.userlogin.acc_num,7)#.#dateformat(barcode.generatedTime, "mmddyyyy")#.#lastId#.#local_num#
					<br><br>
					<div style="margin-top:20x;width:25%;float:left;">
						<b>Work Period:</b>
					</div>
					<div style="margin-top:20x;width:75%;float:left;">
						<b>Reports:</b>
					</div>
					<cfset totalRunTot = 0>
					<cfloop query="getReportInfo">
						<div style="padding-bottom:5px;width:25%;float:left;">
							#getReportInfo.work_period#	
						</div>
						<div style="padding-bottom:5px;width:75%;float:left;">
							#getReportInfo.report_group# - $#getReportInfo.runtot#
						</div>
						<cfset totalRunTot += getReportInfo.runtot>
					</cfloop>
					 
					<div style="margin-top:20px;width:100%;">
						<b>Total Check Amount:</b>
						<br>#DollarFormat(totalRunTot)#
					</div>
					
					<div style="clear:both;float:left;margin:40px 0 0 0;">
						 						 
						 <div><img src="../barcodeImages/#barCode.image#"></div>
						<div style="letter-spacing:#letterspace#;font-weight:bold;">#Left(session.userlogin.acc_num,7)#.#dateformat(barcode.generatedTime, "mmddyyyy")#.#lastId#.#local_num#</div>
					</div> 
				<div>
			</cfoutput>
</cfdocument>
c
Have you verified the contents of barCode.image? And, that barCode.image is an image filename? And, that said filename exists? ...just my two cents...
i
yes - the image display correctly if I use it outside of cfdocument tag <div><img src="../barcodeImages/<cfoutput>#barCode.image#</cfoutput>" alt="barcodexx"></div>
r
Have you tried with an absolute path for the image, instead of a relative path?
i
Yes I did and the same result. The same code works in our production environment but for some reason it is not on a development server with CF development license.
a
@Iyob Zenebe in case you didn't see the feedback on the same question in #cfml-general there's no need to ask the same Q in different channels: one is fine. I've deleted the thread over there so we can focus on this one.
i
ok thanks.
a
How is your dev environment setup? Is it in a docker container or running directly on your computer?
i
Running on my computer