tomolimo / ticketcleaner

Home for Ticket Cleaner GLPI plugin
8 stars 2 forks source link

Images with links. #17

Closed MCGS94 closed 3 years ago

MCGS94 commented 4 years ago

Hi,

I'm sorry if i post this on the wrong section but i'm on a dead end because i have no knowledge about PHP. Can you please tell me how can i remove images with links like:

<img alt="Qries" src="https://www.qries.com/images/banner_logo.png" width=150" height="70">

<a href="https://www.qries.com/"> <img alt="Qries" src="https://www.qries.com/images/banner_logo.png" width=150" height="70"> </a> Thank you very much.

tomolimo commented 4 years ago

Hello @MCGS94 You may add a filter that will look like: @.*@

You may test this filter like explained here: https://github.com/tomolimo/ticketcleaner/wiki/Debug-filters

Regards, Tomolimo

MCGS94 commented 4 years ago

Hi,

Thank you for your fast reply! But unfortunately, it doesn't work.

I've tried to remove the images only before. It works great but it leaves a big empty space. Images with links were on that empty space. (see img below)

tempsnip

This is what i've put on the plugin. Capture

And it seems like nothing hapenned on the Ticketcleaner.log log.txt

Can you please help me find a solution to this problem?

Thank you in advance!

tomolimo commented 4 years ago

Did you try in debug mode like explained here: https://github.com/tomolimo/ticketcleaner/wiki/Debug-filters#how-to-debug-test-filters

MCGS94 commented 4 years ago

debug.txt

Hi , Sorry, i didn't follow the instructions thoroughly but here's what the log says.

PS: i've blocked the images through glpi (management > documents > blacklisted for import > yes )

Hope you can help me :)

Thanks in advance !

tomolimo commented 4 years ago

Hello @MCGS94,

PS: i've blocked the images through glpi (management > documents > blacklisted for import > yes )

Beware that this will block all images....

What you have to understand is that Ticket Cleaner plugin has two parts:

  1. one for cleaning text
  2. and one for preventing import of images (whatever type it can be)

The text cleaning mechanism may be used to clean images too, but it needs to be able to master a little bit the regexp. The image cleaning mechanism is explained here: https://github.com/tomolimo/ticketcleaner/wiki#image-filters

To explain the result you got: the regex @.*@ with empty replacement will delete al the text of the email: this is what you can see on the line:

2019-11-12 14:06:38 [2@srv-glpitest] After filter: mail text:

But it will not delete the images that probably are in the email attachments... To do that you need to put these images into the folder 'pictures' in the 'ticketcleaner' folder.

Regards, Tomolimo

tomolimo commented 3 years ago

Hello, Closed this as it is no longer living... Regards, Tomolimo