I've searched and searched but to no avail, so hopefully you guys may be able to help me out here...
I'm not that clued up on the Smarty template engine and I've read some of the docs but it's all so new to me I can't get my head around it!
Basically I have CG Calendar installed (version 1.2.2) running on CMSMS 1.6. To enable a photo to be added to calendar events I've added a custom 'Image Upload' field to the 'new calendar event' page and have also installed the latest dynresize plugin.
I'd like dynresize to resize the uploaded photo to 300px wide by whatever the aspect ratio height would be but I just can't figure out how to place the correct code in my Event template. My Event template is as follows. I know the {dynresize... part near the bottom needs changing but it gives you an idea of what I'm after! I'm probably way off the mark but I'm guessing that the $fieldvalue needs to go in there somewhere but I don't know how best to insert it between the { and } of dynresize!
Dynresize is definitely doing it's job because when I manually type in the image filename it works so I know that part is working, I just need it to do it automatically! Any help much appreciated. Thanks for reading.
Code: Select all
<div class="calendar-event">
<h1>{$event.event_title}</h1>
{assign var=month_number value=$event.event_date_start|date_format:"%m"}
{assign var=end_month_number value=$event.event_date_end|date_format:"%m"}
{if $event.event_date_start == $event.event_date_end || $event.event_date_end == 0}
<div class="calendar-date-from"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|cms_date_format} {$event.event_date_start|date_format:"%X"}</div>
{else}
{if $event.event_date_start|date_format:"%d%m%Y" == $event.event_date_end|date_format:"%d%m%Y"}
<div class="calendar-date-from"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|cms_date_format} {$event.event_date_start|date_format:"%X"} {$lang.to} {$event.event_date_end|date_format:"%H:%M"}</div>
{else}
<div class="calendar-date-from"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"} {$lang.to} {$event.event_date_end|date_format:"%d"} {$month_names[$end_month_number]} {$event.event_date_end|date_format:"%Y %H:%M"}</div>
{/if}
{/if}
{if $event.event_summary !="" && $event.event_details ==""}
<div class="calendar-summary"><span class="calendar-summary-title">{$lang.summary}: </span>{$event.event_summary}</div>
{/if}
{if $event.event_details !="" && $event.event_details != "<br />"}
<div class="calendar-details"><span class="calendar-details-title">{$lang.details}: </span>{eval var=$event.event_details}</div>
{/if}
{* Display custom fields
There are two ways to address custom fields
1) {$event.fields.fieldname}
2) {foreach from=$event.fields key='fieldname' item='fieldvalue'}
{$fieldname}: {$fieldvalue}<br/>
{/foreach}
You may want to use the former method with file upload fields.
*}
<div class="calendar-fields">
{dynresize path='uploads/images/calendar/"$fieldvalue"' width='300'}
</div>
<div class="calendar-returnlink">{$return_url}</div>
</div>