+ // Grab all pictures with alternative description and create attachments out of them
+ if (preg_match_all("/\[img=([^\[\]]*)\]([^\[\]]*)\[\/img\]/Usi", $body, $pictures, PREG_SET_ORDER)) {
+ foreach ($pictures as $picture) {
+ $imgdata = Images::getInfoFromURLCached($picture[1]);
+ if ($imgdata) {
+ $attachments[] = ['type' => 'Document',
+ 'mediaType' => $imgdata['mime'],
+ 'url' => $picture[1],
+ 'name' => $picture[2]];
+ }
+ }
+ }
+