$attachmentID = $openingTag['attributes'][0];
}
- // get attachment for active object
- $attachments = array();
- if (self::$attachmentList !== null) {
- $attachments = self::$attachmentList->getGroupedObjects(self::$objectID);
+ // get embedded object
+ $attachment = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.attachment', $attachmentID);
+ if ($attachment === null) {
+ if (self::$attachmentList !== null) {
+ $attachments = self::$attachmentList->getGroupedObjects(self::$objectID);
+ if (isset($attachments[$attachmentID])) {
+ $attachment = $attachments[$attachmentID];
+
+ // mark attachment as embedded
+ $attachment->markAsEmbedded();
+ }
+ }
}
- if (isset($attachments[$attachmentID])) {
- $attachment = $attachments[$attachmentID];
-
- // mark attachment as embedded
- $attachment->markAsEmbedded();
-
+ if ($attachment !== null) {
- if ($attachment->showAsImage() && $parser->getOutputType() == 'text/html') {
+ if ($attachment->showAsImage() && $attachment->canViewPreview() && $parser->getOutputType() == 'text/html') {
// image
$linkParameters = array(
'object' => $attachment