Added option to obtain thumbnail dimensions
authorSascha Greuel <sascha@softcreatr.de>
Tue, 8 Oct 2013 21:43:51 +0000 (23:43 +0200)
committerSascha Greuel <sascha@softcreatr.de>
Tue, 8 Oct 2013 21:43:51 +0000 (23:43 +0200)
See
http://beta.woltlab.com/index.php/Thread/4094-Dateianh%C3%A4nge-Vorschau-besser-skalieren/

com.woltlab.wcf/option.xml
wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php
wcfsetup/install/files/style/attachment.less
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 46fedbf2a404cb49e49d02f657266bf828a5bf70..83897eb9db66fe61fd3dd1192c84360f62089ba3 100644 (file)
@@ -615,7 +615,12 @@ no:!cache_source_memcached_host]]></enableoptions>
                                <categoryname>message.attachment</categoryname>
                                <optiontype>boolean</optiontype>
                                <defaultvalue><![CDATA[1]]></defaultvalue>
-                               <enableoptions>attachment_thumbnail_height,attachment_thumbnail_width</enableoptions>
+                               <enableoptions>attachment_obtain_dimensions,attachment_thumbnail_height,attachment_thumbnail_width</enableoptions>
+                       </option>
+                       <option name="attachment_obtain_dimensions">
+                               <categoryname>message.attachment</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue><![CDATA[0]]></defaultvalue>
                        </option>
                        <option name="attachment_thumbnail_height">
                                <categoryname>message.attachment</categoryname>
index 2312d37e3f2c134e208805cdcc0959cd7bc0be56..72e0921f3011215325b3a27a5c76051fe966dbe4 100644 (file)
@@ -282,7 +282,7 @@ class AttachmentAction extends AbstractDatabaseObjectAction {
                        // create standard thumbnail
                        if ($attachment->width > ATTACHMENT_THUMBNAIL_WIDTH || $attachment->height > ATTACHMENT_THUMBNAIL_HEIGHT) {
                                $thumbnailLocation = $attachment->getThumbnailLocation();
-                               $thumbnail = $adapter->createThumbnail(ATTACHMENT_THUMBNAIL_WIDTH, ATTACHMENT_THUMBNAIL_HEIGHT, false);
+                               $thumbnail = $adapter->createThumbnail(ATTACHMENT_THUMBNAIL_WIDTH, ATTACHMENT_THUMBNAIL_HEIGHT, ATTACHMENT_OBTAIN_DIMENSIONS);
                                $adapter->writeImage($thumbnail, $thumbnailLocation);
                                if (file_exists($thumbnailLocation) && ($imageData = @getImageSize($thumbnailLocation)) !== false) {
                                        $updateData['thumbnailType'] = $imageData['mime'];
index 1fc0ec4d4384b9e64733b4174a6d43b1dce2080f..6651342be88b60864080075e900fa45ac5660b77 100644 (file)
        min-height: ~"@{wcf_option_attachment_thumbnail_height}px";
        min-width: ~"@{wcf_option_attachment_thumbnail_width}px";
        position: relative;
-       vertical-align: top;
+       text-align: center;
+               
+       > img {
+               margin-left: 0px !important;
+       }
        
        > a {
                display: inline-block;
index 15c05c3e060b80614d72ac45cb6272c2ebcb77d1..f8dfb27a69807602f5a420734d063a3941a24c51 100644 (file)
                <item name="wcf.acp.option.recaptcha_privatekey"><![CDATA[Private-API-Key]]></item>
                <item name="wcf.acp.option.category.message.attachment"><![CDATA[Dateianhänge]]></item>
                <item name="wcf.acp.option.attachment_enable_thumbnails"><![CDATA[Vorschaugrafiken von hochgeladenen Bilder erzeugen]]></item>
+               <item name="wcf.acp.option.attachment_obtain_dimensions"><![CDATA[Bildformat beim Erzeugen von Vorschaugrafiken beibehalten]]></item>
                <item name="wcf.acp.option.attachment_thumbnail_height"><![CDATA[Höhe der Vorschaugrafiken]]></item>
                <item name="wcf.acp.option.attachment_thumbnail_width"><![CDATA[Breite der Vorschaugrafiken]]></item>
                <item name="wcf.acp.option.attachment_storage"><![CDATA[Speicherort der Dateianhänge]]></item>
index a71574177d988aab0d379e254d130cf3b09c9960..191d0a46f8d22db492db38802a18346a0ddc7241 100644 (file)
@@ -705,6 +705,7 @@ Examples for medium ID detection:
                <item name="wcf.acp.option.recaptcha_privatekey"><![CDATA[Private API Key]]></item>
                <item name="wcf.acp.option.category.message.attachment"><![CDATA[Attachments]]></item>
                <item name="wcf.acp.option.attachment_enable_thumbnails"><![CDATA[Create thumbnails for uploaded images]]></item>
+               <item name="wcf.acp.option.attachment_obtain_dimensions"><![CDATA[Obtain thumbnail dimensions]]></item>
                <item name="wcf.acp.option.attachment_thumbnail_height"><![CDATA[Thumbnail Height in Pixel]]></item>
                <item name="wcf.acp.option.attachment_thumbnail_width"><![CDATA[Thumbnail Width in Pixel]]></item>
                <item name="wcf.acp.option.attachment_storage"><![CDATA[Storage Location]]></item>