From: Alexander Ebert Date: Thu, 5 Feb 2015 17:52:21 +0000 (+0100) Subject: Fixed setting attachments to float w/ ImageViewer X-Git-Tag: 2.1.0_RC_1~79^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1761be9bfb930ce85bcd787bfd9fc3b4301099df;p=GitHub%2FWoltLab%2FWCF.git Fixed setting attachments to float w/ ImageViewer --- diff --git a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php index 3b5918a9f9..191f14fc3c 100644 --- a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php @@ -9,7 +9,7 @@ use wcf\util\StringUtil; * Parses the [attach] bbcode tag. * * @author Marcel Werk - * @copyright 2001-2014 WoltLab GmbH + * @copyright 2001-2015 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.bbcode @@ -75,18 +75,18 @@ class AttachmentBBCode extends AbstractBBCode { $result = ''; if ($width > 0) { - $style = 'width: '.$width.'px;'; + $style = ''; if ($alignment == 'left') { - $style .= ' float: left; margin: 0 15px 7px 0;'; + $style .= 'float: left; margin: 0 15px 7px 0'; } else if ($alignment == 'right') { - $style .= ' float: right; margin: 0 0 7px 15px;'; + $style .= 'float: right; margin: 0 0 7px 15px'; } $source = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment))); $title = StringUtil::encodeHTML($attachment->filename); - $result = ''; + $result = ''; } else { $linkParameters = array( @@ -94,9 +94,17 @@ class AttachmentBBCode extends AbstractBBCode { ); if ($attachment->hasThumbnail()) $linkParameters['thumbnail'] = 1; - $result = 'hasThumbnail() ? ' class="embeddedAttachmentLink jsResizeImage"' : '').' style="width: '.($attachment->hasThumbnail() ? $attachment->thumbnailWidth : $attachment->width).'px; height: '.($attachment->hasThumbnail() ? $attachment->thumbnailHeight: $attachment->height).'px;'.(!empty($alignment) ? ' float:' . ($alignment == 'left' ? 'left' : 'right') . '; margin: ' . ($alignment == 'left' ? '0 15px 7px 0' : '0 0 7px 15px' ) : '').'" alt="" />'; + $style = ''; + if ($alignment == 'left') { + $style .= 'float: left; margin: 0 15px 7px 0'; + } + else if ($alignment == 'right') { + $style .= 'float: right; margin: 0 0 7px 15px'; + } + + $result = 'hasThumbnail() ? ' class="embeddedAttachmentLink jsResizeImage"' : '').' style="width: '.($attachment->hasThumbnail() ? $attachment->thumbnailWidth : $attachment->width).'px; height: '.($attachment->hasThumbnail() ? $attachment->thumbnailHeight: $attachment->height).'px;' . ((!$attachment->hasThumbnail() || !$attachment->canDownload()) ? $style : '').'" alt="" />'; if ($attachment->hasThumbnail() && $attachment->canDownload()) { - $result = ''.$result.''; + $result = ''.$result.''; } }