Did you know that from version 8.5 of Ektron CMS you can resize images dynamically with no extra coding required? There are a few restrictions:
- File must be added as an asset to the DMS – it cannot be a Library file.
- It must be a JPEG or GIF file – PNG will not work.
So here is what you do :
- From the workarea, go to the Content view
- From the toolbar choose the Add Assets icon.
- Browse to your image and upload it.
- Go to the Properties tab on the image and make a note of the Content Id.
- Now browse to the image like so :
http://www.mysite.com/assets/123.jpg?ht=100
This will load the image and resize it so that the image is 100 pixels high- the width size will be constrained to the height, i.e. the proportions are kept the same.
The “123” specified here corresponds to the Content Id – this is important, you must use the Content Id and not the QuickLink.
You can also specify the image resize by width:
http://www.mysite.com/assets/123.jpg?wd=200
Or you can resize by both height and width (potentially throwing out the proportions):
http://www.mysite.com/assets/123.jpg?wd=200&ht=150
Or you can show the auto-generated image thumbnail:
http://www.mysite.com/assets/123.jpg?sz=thumb
This gives a very nice way of showing an image in a particular size without having to resize it through code. Before version 8.5 it would have been necessary to write a plug-in or extension that resized images after publication.