I figured out a way to include dynamically generated thumbnail images from a news module custom file field for use in News Summary templates.
1. First, download the DynResizer plugin here: http://dev.cmsmadesimple.org/project/files/632
2. Follow instructions here on where to install files: http://s3.amazonaws.com/cmsms/downloads/3300/README.txt
3. Add a custom filed definition of type file in the news module (News > Field Definitions > Add Field Definition). I called my field definition 'article_image'
4. Edit the dynresizer plugin (plugins/function.dynresize.php) and modify the code to allow for the use of alt tags
After line 22 (
Code: Select all
$path = isset($params['path']) ? $params['path']:false;
Code: Select all
$alt = isset($params['alt']) ? $params['alt']:false;
Code: Select all
echo "<img src=\"imager.php?id=$encoded_link\" title=\"$title\"/>"
Code: Select all
echo "<img src=\"imager.php?id=$encoded_link\" title=\"$title\" alt=\"$alt\"/>"
Code: Select all
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
<div class="NewsSummaryField">
{if $field->type == 'file'}
{assign var='loc' value=$entry->file_location}
{assign var='theFile' value=$field->value}
{dynresize path=$loc|cat:'/'|cat:$theFile width='90' alt=$entry->title|escape:htmlall}
{else}
{$field->name}: {eval var=$field->value}
{/if}
</div>
{/foreach}
{/if}
I'm not much of a programmer so please feel free to comment on making this code simpler and cleaner.
Hope this is useful.