The image resizer
With the new Image Resizer Extension point, it is now easier to manage how the image should be resized.
In the example below, we will use a field on the Litium.Media.File to define what to do with the image when the image is requested by the browser.
The logic is in two different classes, one is generating the URL for the image and the second is the actual resizer.
There is a decorator for the MediaLocationService that is the part that generate the URL for the image. The field will be fetched from the Litium.Media.File object and assign a field-value to the args.CustomData that will be serialized into the image URL.

Now when there is modification on how the image URL will be generated, it is important to decorate the BlobImageResizer to update and use another resize algoritm if the specified CustomData with the specific value exists in the URL.

In Litium, we use ImageMagick library to resize image, and with this one we can also convert eps/pdf/ps files to image file by installing ghost-script.
The application pool identity should have write permission to the MagickNET temp directory. The MagickNET temp directory is "C:\Windows\Temp" by default.
How to add and config Ghost-script
The Ghost-script is only needed when we must convert PS, EPS, PDF file.
The Ghost-script DLLs can be downloaded here:
http://www.ghostscript.com/download/gsdnld.html.
After installing Ghost-script, copy the DLLs and locate them on the local environment. The DLLs included "gsdll32.dll/gsdl64.dll" and "gswin32c.exe/gswin64c.exe" depend on the local platform.
The Ghost-script on Litium required two application settings keys:
- Litium:ImageResize:GhostScriptPath – the place we located the ghost-script DLLs
- Litium:ImageResize:ConvertExtensions – the value for the image extensions that accepted to convert.
- For example:
