When installing 2SexyContent 5.3 (or newer), the ImageResizer from imageresizing.net is automatically installed. ImageResizer is a very powerful set of image tools that allows you to resize images by just adding some parameters to the image url.
Every image in your DotNetNuke website is ready for getting resized or cropped. Just add the follwing parameters to an image URL to see it in action:
This will resize the original example.jpg to 100 x 100 px. There are plenty of other options you can add to any image url.
You can add a parameter „mode“ to change the behaviour of the image resizer. These are the most often used options:
Constrain by height (while preserving the original ratio)
Constrain by width (while preserving the original ratio)
Makes sure that both the width and height don’t exceed 100 px. (while preserving the original ratio)
Pads the image with whitespace
Makes sure the image is not more than 100 x 100 px. If the original ratio is different, the image is cropped.
Beyond width, height and mode, there are many other parameters you can add like Scale, Alignment, Format, Compression, Background Color. If you want to, you can even add a PDF preview plugin to ImageResizer! (more options documented on 2SexyContent.org or imageresizing.net).
Usage with 2SexyContent
Here’s how to add the image resizer to your 2SexyContent template. Create a content type with a file field, call it Image. In your template, write:
[Content:Image]?w=100&h=100&mode=crop (Token templates)
or @Content.Image?w=100&h=100?mode=crop (Razor templates)
The image resizer will crop the images to 100 x 100 px. Play around with these values to match your template. You or your customer can upload images directly from the camera – the template will make sure the image fits.
By default, 2SexyContent contains the TinyCache plugin which offers a fixed-size cache of 30 mb. If you have a website with many images (a few hundreds), you should consider buying an ImageResizer license, which allows you to use the DiskCache plugin for production use.
More information about licensing: http://imageresizing.net/licenses
If you have questions, contact me at email@example.com.