Though you may use regular Joomla!® content plugins (for list details and articles), there are a few special ones written and shipped with ContentBuilder that help you to spice up your or even add functionality to your content.
Content:
The 3 most important plugins of this kind currently are „Image Scale“, „Download“ and „Verify“. Please make sure all these plugins are installed and enabled (should already be the case) or do so if missing:
1 - "IMAGE SCALE'' PLUGIN
• „Image Scale“: this plugin tries to pick a value and render a scaled image out of it (usually an image path from an upload type form element). This plugin may be used to create image galleries, profile pages or any content where images might come into play.
So let's say you have an upload form element where the user is supposed to upload an image and the name of that element would be „myimage“, then simply add this tag into the
„Content Template“ of your view:
{CBImageScale field: myimage; width: 50;}
This will render a thumbnail of the size width and height 50px, right at the spot where you defined it. If Image Scale is not able to render this image, it will return nothing.
There are several reasons why rendering is not possible. The plugin is clever enough not to run into memory or timeout issues, so if nothing is rendered at all (not even in the html source), then it is most likely that the file is not existing, too large or would consume too much time or memory to scale down.
Once the image has been generated, it will be cached to prevent cpu and memory overhead on your server. The default cache time is 86400 seconds (= 1 day) but this value may be altered. If the image is updated and the width or height differs from the cached one, it will automatically create a new cached image.
Supported image types are GIF, JPG and PNG.
Here is a list of all available options with example values to call the Image Scale plugin:
width: 50; | will render the image with the width of 50 pixels. If only the width is given, it will use the same value for height.Either width or height is required. |
height: 50; | will render the image with the height of 50 pixels. If only the height is given, it will use the same value for height.Either width or height is required. |
field:*fieldname* | the name of the field to pick the path to the image from (usually a file upload field). |
background- color: #ffffff | the color for the background space if the scaled image doesn't fit within the given width/height boundaries as hex |
value folder: tmp; | an alternative cache folder. Default is media/contentbuilder/plugins/image_scale/cache |
cache: 86400 | the caching time for this image. Default is 86400 seconds. If set to „none“, caching will be disabled for this image. |
globale_cache: 86400 | the global cache time for all images within the given folder. All cached images within this folder will be deleted after the given seconds. Default is 86400 seconds. |
align: left; | Will float the image into the given direction. Possible values are „left“ or „right“. |
open: true; | if set to „true“, the scaled image will be clickable, opening the original image within a modal window. If the dimensions of the image exceed a certain size, it will skip displaying as modal and instead use a regular javascript based popup window. |
alt:*some alternative text* | adds an alternative alt text to the generated image tag |
title:*some title text* | adds a title to the generated image tag |
2 - ''DOWNLOAD'' PLUGIN
• „Download“: another interesting content plugin for ContentBuilder to create downloads from upload fields. With this plugin you may implement download galleries or paid download in combination with verification plugins (for example paypal).
The procedure is similiar to Image Scale, except that it handles downloads. Beside serving downloads, it will count the hits for each file, display mime type and file size information. All these information may be turned off by the plugin settings. Please note that if you are using IIS and CGI you will have to raise the CGI execution time in order to offer big files. Users of Apache webservers are not affected!
So let's say you have an upload form element where the user is supposed to upload a zip file and the name of that element would be „myfile“, then simply add this tag into the „Content Template“ of your view:
{CBDownload field: myfile;}
This will render a download box if the file exists. Otherwise it won't display anything.The download box contains the following information:
Each information entitiy may be turned off with the plugin settings. Currently, the following
◦ File name
◦ Mime type
◦ File size
◦ Number of downloads
settings are available:
field: *fieldname*; | the name of the upload field |
box-style: border-width:thin::border-color:#000000; | the style of the box that contains the download. Use regular CSS here. Please seperate each css directive by „::“ instead of semicolon! |
info-style: color: red; | same usage as box-style, will be applied to the container that is wrapped by the box. |
align: left; | Will float the image into the given direction. Possible values are „left“ or „right“. |
info: false; | if set to „false“ all info for this download will be turned off. Default is „true“. |
hide-filename: true; | if set to „true“, the filename will be hidden from the info. |
hide-mime: true; | if set to „true“, the mime type will be hidden from the info. |
hide-size: true; | if set to „true“, the size will be hidden from the info. |
hide-downloads: true; | if set to „true“, the amount of downloads will be hidden from the info. |
alt:*some alternative text* | adds an alternative alt text to the generated image tag |
title:*some title text* | adds a title to the generated image tag |
3 - ''VERIFY'' PLUGIN
Currently, these are the two most important content plugins that ship with ContentBuilder but there is another one that you shouldn't miss - the Verify plugin.
Follow the link for more information about Verify plugin and examples.