Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to resize only big images? [snippet won't work]


Go to End


2 Posts   1378 Views

Avatar
benni91

Community Member, 72 Posts

28 August 2011 at 1:05pm

Hi,
i found this http://www.ssbits.com/tutorials/2011/improving-image-quality-by-preventing-correctly-sized-images-being-resized/ snippet but it won't work :/

so is there any other possibility to prevent correctly sized images being resized?

While using the searchfunction i found something about the gd functions. but i don't understand them :/

can someone help me?

Avatar
zenmonkey

Community Member, 545 Posts

29 September 2011 at 8:34am

If the images are sized correctly, you should be calling them form the template using $Image with no dot functions (.SetWidth etc). Now if you're unsure if you're users will provide correct images you can always create a new function that checks the image size and only resize if its bigger than a specific size.