
petercawdron
Kilo Guru
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 11-18-2019 07:41 PM
I'm pretty sure there are other ways to do this, but my particular client need to not only remove the facebook and twitter icons from inbound emails, but also other images (like company logos, etc), so this was scheduled job set to run a couple of times a day to clean things up.
var removeSmallImages = new GlideRecord('sys_attachment');
removeSmallImages.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^table_name=incident^ORtable_name=interaction^ORtable_name=sc_req_item^content_type=image/png');
removeSmallImages.query();
while(removeSmallImages.next()){
var fileSize = parseInt(removeSmallImages.size_bytes.getValue());
if(fileSize < 7500){
removeSmallImages.deleteRecord();
}
}
The advantage of this approach is you can set the minimum image size.
Labels:
- 281 Views