[rt-users] Custom Field Attachments to Templates

Jeff Ehrenberg bigwa420 at gmail.com
Tue Jul 31 13:42:34 EDT 2012


I decided to revisit this idea of including custom field photos in the
resolved email response.  I think I am close to a solution but I am getting
hung up on some formatting.
I am able to retrieve the blob data for the LargeContent field and then
base64 encode it.  From there I am putting it in to an html email and then
using an <img> tag like this:
<img src="data:image/jpg;base64,
encode_base64($customFieldValue->LargeContent, '')">

The email arrives html formatted but the problem is that there seem to be
newline characters inserted in the base64 encoded blob.  The encoded data
seems to be in groups of 989 characters before a new line.  I have tried
numerous ways to remove the newlines, but none have worked.  I am thinking
that this might have something to do with the Text::Template module?

If I remove the extra whitespace from the email and then save it as html,
the photos will display correctly.

Any ideas?
an example of what I am seeing in the html source:
<img
src="data:image/jpg;base64,_9j_4T_-RXhpZgAASUkqAAgAAAAMAA4BAgAgAAAAXAUAAA8BAgAYAAAAfAUAABABAgARAAAAlAUAABIBAwABAAAAAQAAABoBBQABAAAAKAUAABsBBQABAAAAMAUAACgBAwABAAAAAgAAADEBAgAgAAAApgUAADIBAgAUAAAASAUAABMCAwABAAAAAgAAAGmHBAABAAAAngAAAKXEBwAUAgAAyAUAACQCAAAgAJqCBQABAAAAqAgAAJ2CBQABAAAA0AgAACKIAwABAAAAAgAAACeIAwABAAAAZAAAAACQBwAEAAAAMDIyMQOQAgAUAAAAfQgAAASQAgAUAAAAkQgAAAGRBwAEAAAAAQIDAASSCgABAAAAsAgAAAWSBQABAAAAuAgAAAeSAwABAAAABQAAAAiSA
 wABAAAAAAAAAAmSAwABAAAAGQAAAAqSBQABAAAAyAgAAHySBwBcHgAAJAkAAIaSBwB9AAAAAAgAAACgBwAEAAAAMDEwMAGgAwABAAAAAQAAAAKgBAABAAAAQAYAAAOgBAABAAAAsAQAAAWgBAABAAAAcgIAAACjBwABAAAAAwAAAAGkAwABAAAAAAAAAAKkAwABAAAAAAAAAAOkAwABAAAAAAAAAASkBQABAAAA5AgAAAWkAwABAAAAJAAAAAakAwABAAAAAAAAAAekAwABAAAAAQAAAAikAwABAAAAAAAAAAmkAwABAAAAAAAAAAqkAwABAAAAAAAAAAAAAAAGAAMBAwABAAAABgAAABoBBQABAAAA_AgAABsBBQABAAAABAkAACgBAwABAAAAAgAAAAECBAABAAAAlCcAAAICBAABAAAA6hYAAAAAAAACAAEAAgAEAAAAUjk4AAIABwAEAAAAMDEwMAAAAADcBwcaByM0AAAAAAARAYAAgQD0AAgAQEAAAP8P_w_PALr_9v_n_78A2P8DAMz_rwAAAAAAAAAAAAAAAAAAAAAAAAAAAKAnAAAAAAIAAAEAAQABAAEAAAAAAAAAAAAAAAAAAAgAAQAIAAAAAAAABAAAAgAAAAAAAAADAAMABgACAAAAAABkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAACLwUAAQALAAUAAAAAJAQkBBIEAACu_sD-hf4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALUKUA4MAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

On Wednesday, February 15, 2012, Kevin Falcone wrote:

> On Wed, Feb 15, 2012 at 11:08:09AM -0500, Jeff Ehrenberg wrote:
> >    Thanks for the reply Kevin. I am not a developer so I am not sure I
> really understand your
> >    answer or where to begin looking. Any additional information on this
> would be great.
>
> Any solution is going to require significant new code.
> You can view the code I referenced in the 4.2/attach-from-transactions
> branch, which isn't quite ready for merging into master and as I
> mentioned before, won't show up in a core release until 4.2 (assuming
> it's completed).
>
> -kevin
>
> >
> >    On Friday, February 10, 2012, Kevin Falcone <[1]
> falcone at bestpractical.com <javascript:;>> wrote:
> >    > On Fri, Feb 10, 2012 at 08:31:49AM -0500, Jeff Ehrenberg wrote:
> >    >> I am wondering if it is possible to attach files that have been
> >    >> uploaded to custom fields to an email response. We have an upload
> >    >> multiple images field and an upload multiple files field that are
> used
> >    >> on most tickets. I would like to be able to include the photos and
> >    >> pdfs in the resolved email that gets sent to the requestor. I know
> >    >> that the blobs are stored in the LargeContent field, but can't
> figure
> >    >> out how to get them in to the template as attachments. Anyone know
> if
> >    >> this is possible?
> >    >
> >    > Unfortunately - you can't do this easily. You'd need to write your
> >    > own subclass of the Notify actions. There is code on a branch off of
> >    > the master branch which simplifies some of these code paths, but
> that
> >    > won't be in a core release until 4.2.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120731/3bbf97c6/attachment.htm>


More information about the rt-users mailing list