-
Notifications
You must be signed in to change notification settings - Fork 0
bemoko/imagetranscoder
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Background ------------------------------------------------------------------------------- bemokoLive plugin that resizes images Installation ------------------------------------------------------------------------------- * Drop the following files into your site conf/imagetranscoder.cfg plugins/imagetranscoder/ImageTranscoder.groovy plugins/imagetranscoder/ImageTranscodeRenderer.groovy Note that you should maintain this folder structure, i.e. put conf/imagetranscoder.cfg in a folder called "conf" in you site directory and put plugins/imagetranscoder/ImageTranscoder.groovy in a folder called "plugins/imagetranscoder" Usage ------------------------------------------------------------------------------- Define content source in your bemoko site <content-sources> <source name="transcoder" plugin="imagetranscoder.ImageTranscoder" scope="site"/> </content-sources> register the imagetranscoder configuration file <config> <source file="imagetranscoder.cfg"/> </config> along with the transcode renderer <intents> <intent name="t" type="renderer"> <renderer plugin="imagetranscoder.ImageTranscodeRenderer"/> </intent> </intents> In your template include URLs to transcoded image with the "content.transcoder.uri" method, e.g. <img src="${content.transcoder.uri('100.jpeg','/snow.jpg')}" alt="snow"/> <img src="${content.transcoder.uri('100.jpeg','http://be/snow.jpg')}" alt="snow"/> where the first argument is the rule specifying how to transcode and the second argument is the absolute URL of the image or site relative URL. Supported rules are * nnn.jpeg -> resize to nnn pixels wide * nnnxmmm.jpeg -> resize to nnn pixels wide and mmm pixels high * cropnnn -> crop to nnn pixels wide * nnn-cropmmm.jpeg -> resize to nnn pixels wide and then crop to mmm pixels high You can use device capabilities to resize, e.g. resize to width of device with <img src="${content.transcoder.uri(device.displayWidth + '.jpeg','/snow.jpg')}" alt="snow"/>