/**
  * adds image property with image url like this:
  *  'index.php?method=Tinebase.getImage&application=Tinebase&location=vfs&id=e4b7de34e229672c0d5e22be0912779441e6e051'
  *
  * @param $records
  */
 public static function resolveAttachmentImage($records)
 {
     // get all images from attachments and set 'image' properties
     // TODO find an additional condition to better detect the attachments that should be the record image(s)
     /** @var Tinebase_Record_Interface $record */
     foreach ($records as $record) {
         if ($record->has('image') && $record->attachments instanceof Tinebase_Record_RecordSet) {
             foreach ($record->attachments as $attachment) {
                 if (in_array($attachment->contenttype, Tinebase_ImageHelper::getSupportedImageMimeTypes())) {
                     $record->image = Tinebase_Model_Image::getImageUrl('Tinebase', $attachment->getId(), 'vfs');
                     break;
                 }
             }
         }
     }
 }