Known Participant
March 31, 2020
Question
ImageWrite ram destination best practise?
- March 31, 2020
- 5 replies
- 1640 views
Hi,
Im including a barcode in a email, within a cfloop:
<cfset myImage=ImageNew("",200,70,"grayscale","white")>
<cfset attr = StructNew()>
<cfset attr.font="Archon Code 39 Barcode">
<cfset attr.size=50>
<cfset ImageSetDrawingColor(myImage,"black")>
<cfset ImageAddBorder(myImage,1,"black")>
<cfset ImageDrawText(myImage,"*#email.unique_id#*",15,50,attr)>
<cfset ImageWrite(myImage, "ram:///barcode#email.unique_id#.jpg", 1, "true")>
within cfmail tag:
<img src="cid:Barcode#email.unique_id#" width="200" height="70" alt="#email.unique_id# Barcode" />
<cfmailparam file="ram:///barcode#email.unique_id#.jpg"
contentid="Barcode#email.unique_id#"
disposition="inline" />
<cfmailparam file="ram:///barcode#email.unique_id#.jpg"
contentid="Barcode#email.unique_id#"
disposition="inline" />
The image is re-created each loop, but I had to give it a unique name per loop as the image never changed in the email.
Do you have to "dispose" of the image each loop?
Do I have to delete the image of out RAM ?
Do I have to delete the image of out RAM ?
Any extra tips you have\best practice?
Thanks,
