Added feature: New option "noScale" for getImgResource() to display the original...
authorBenni Mack <benni.mack@typo3.org>
Sat, 13 Nov 2010 17:25:41 +0000 (17:25 +0000)
committerBenni Mack <benni.mack@typo3.org>
Sat, 13 Nov 2010 17:25:41 +0000 (17:25 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9371 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_stdgraphic.php
typo3/sysext/cms/tslib/class.tslib_content.php

index f0237a2..e6b83ee 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-11-13  Benjamin Mack  <benni@typo3.org>
 
+       * Added feature: New option "noScale" for getImgResource() to display the original image instead of a scaled one (Thanks to Stefan Geith)
        * Fixed bug #7855: IRRE doesn't save collapse/expand state of nested IRRE records
        * Fixed bug #9508: Workspace preview link should work in multidomain-environments (Thanks to Michael Klapper)
        * Added feature #13170: Workspace Owners should be manageable with groups as well (Thanks to Tolleiv Nietsch)
index 664aac7..6d5f510 100644 (file)
@@ -2332,10 +2332,20 @@ class t3lib_stdGraphic  {
                                $w=$data['origW'];
                                $h=$data['origH'];
 
-                                       // if no convertion should be performed
-                               $wh_noscale = (!$w && !$h) || ($data[0]==$info[0] && $data[1]==$info[1]);               // this flag is true if the width / height does NOT dictate the image to be scaled!! (that is if no w/h is given or if the destination w/h matches the original image-dimensions....
-
-                               if ($wh_noscale && !$data['crs'] && !$params && !$frame && $newExt==$info[2] && !$mustCreate) {
+                                       // if no conversion should be performed
+                                       // this flag is true if the width / height does NOT dictate 
+                                       // the image to be scaled!! (that is if no width / height is
+                                       // given or if the destination w/h matches the original image
+                                       // dimensions or if the option to not scale the image is set)
+                               $noScale = (!$w && !$h) || ($data[0] == $info[0] && $data[1] == $info[1]) || $options['noScale'];
+
+                               if ($noScale && !$data['crs'] && !$params && !$frame && $newExt == $info[2] && !$mustCreate) {
+                                               // set the new width and height before returning, 
+                                               // if the noScale option is set
+                                       if ($options['noScale']) {
+                                               $info[0] = $data[0];
+                                               $info[1] = $data[1];
+                                       }
                                        $info[3] = $imagefile;
                                        return $info;
                                }
index a4b2154..1a1611e 100644 (file)
@@ -4752,6 +4752,7 @@ class tslib_cObj {
                                                $fileArray['maxH'] = intval($this->stdWrap($fileArray['maxH'], $fileArray['maxH.']));
                                                $fileArray['minW'] = intval($this->stdWrap($fileArray['minW'], $fileArray['minW.']));
                                                $fileArray['minH'] = intval($this->stdWrap($fileArray['minH'], $fileArray['minH.']));
+                                               $fileArray['noScale'] = $this->stdWrap($fileArray['noScale'], $fileArray['noScale.']);
                                                $maskArray = $fileArray['m.'];
                                                $maskImages = array();
                                                if (is_array($fileArray['m.'])) { // Must render mask images and include in hash-calculating - else we cannot be sure the filename is unique for the setup!
@@ -4800,6 +4801,9 @@ class tslib_cObj {
                                                        if ($fileArray['minH']) {
                                                                $options['minH'] = $fileArray['minH'];
                                                        }
+                                                       if ($fileArray['noScale']) {
+                                                               $options['noScale'] = $fileArray['noScale'];
+                                                       }
 
                                                                // checks to see if m (the mask array) is defined
                                                        if (is_array($maskArray) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['im']) {