How to add inline images via Web interface

Hi there,
I’ve been trying to find a way to add inline images to tickets, replies, comments, etc. via the web interface as it happens when a ticket is created via email. I’ve done it successfully with:

  1. adding popup and filebrowser plugins to CKEditor
  2. adding server side script for uploading images and
  3. Setting $Framebusting to suppress X-Frame-Options: DENY header
  4. manipulating lib/RT/Interface/Web.pm to handle such cases and generating necessary mime types (i.e. multipart/related etc.)
  5. manipulating lib/RT/Transaction.pm to remove link to images in the editor when adding comments

It looks like everything works properly but the problem is I don’t want to patch the source code and want to use other mechanisms like hooks (i.e. callbacks) but I couldn’t find a proper callback for that.
Could someone please let me know what callbacks I can use for items 4 and 5?

Thanks in advance.

Hi guys. Don’t you have any comments?

If you search in the library files for “m->callback(” you can find all the places the subroutines provide for a callback to be inserted - whether those will be useful for you will depend how your code works.

You might also want to look at overlays, so you can just replace/extend the subroutines you need to rather than making a local copy of the entire file.

1 Like

Thanks. I looked for the callbacks and tried several ones that seemed to be related to ticket creation without success.
So, I think I have two options:

  1. To patch lib/RT/Interface/Web.pm to add my own callbacks
  2. To use overlays.
    I’ll try overlays first because I need to modify sub MakeMIMEEntity located in lib/RT/Interface/Web.pm.

This would be great for signatures, I hope you publish your results.

I used overlays and it looks like it’s working. I haven’t run all tests related to the web interface yet.
I created a file with the name Web_Local.pm in lib/RT/Interface directory and overrode sub MakeMIMEEntity. I also added no warnings qw(redefine); to stop related warnings.