7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Image Gallery : keep original size if Normal Size is much larger
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 886 Views |
-
Image Gallery : keep original size if Normal Size is much larger

27 February 2010 at 10:55am Last edited: 27 February 2010 10:58am
I have very little and big images in my album. I set "Normal Size" to 100px. But little images are pixelized when they are displayed...
So i would like to keep image's original size when my "Normal Size" configuration is bigger than it.
To do it, I modified "ImageGalleryPage.php" lines 272-275 :
if($item->Image()->Landscape())
$normalImg = $item->Image()->SetWidth($this->NormalSize);
else
$normalImg = $item->Image()->SetHeight($this->NormalSize);by
$normalImg = $item->Image();
if($item->Image()->Landscape() && ($item->Image()->getWidth() > $this->NormalSize) )
$normalImg = $item->Image()->SetWidth($this->NormalSize);
elseif ($item->Image()->getHeight() > $this->NormalSize)
$normalImg = $item->Image()->SetHeight($this->NormalSize);Hope this help somebody !
Is there another cleaner way to do that ? thanks.
-
Re: Image Gallery : keep original size if Normal Size is much larger

27 February 2010 at 12:09pm
Interesting, but I have to ask... you're seriously displaying an image that is smaller than 100px in a lightbox?!
-
Re: Image Gallery : keep original size if Normal Size is much larger

27 February 2010 at 12:23pm Last edited: 27 February 2010 12:25pm
hu hu
No, it was juste an example. In fact, i had set NormalSize to 250px and some little images to 100 and 120px.
ps : Perhaps we could add a configuration checkbox like "set Normal Size as Max size". Another possibility will be an option "keep original size" for example.
| 886 Views | ||
|
Page:
1
|
Go to Top |

