I'm getting some strange behavior from a CGBlog template which calls CGSmartImage. Problem is with the CGSmartImage image tag (below). Looking at the resulting HTML source, the output of the CGSmartImage tag is blank, and no image is displayed. I've checked the variables and confirmed they are set correctly. I can replace the $path and $image variables with strings and the image is displayed correctly.
The resulting <img> looks like:
<img alt="Image Title" src=""/>
[CGSmartImage tag appears to have returned an empty string]
My questions:
- Assuming the CGSmartImage tag is getting valid parameters, is there a way to debug why it's not returning any data? Does it write errors to a log anywhere?
- It is possible any of the changes in 2.2 re: smarty variables might be affecting this code?
I don't want to confuse things further, but perhaps a clue: If I go to System Maintenance and clear the cache, the first time I reload the browser page, all of the CGSmartImage tags return the same image -- an image for one of the blog entries is shown for EVERY blog entry. THEN: if I hit reload again on the browser window, NO images are shown -- the CGSmartImage tag returns nothing for any blog entry. I can reproduce this sequence of events (clear cache, reload page and see repeated single image, reload page and see nothing.)
I've been banging my head on the wall for some time -- any ideas are MUCH appreciated!
Kirk
Relevant code snippet follows:
Code: Select all
<!-- Start CGBlog Display Template -->
{if isset($error)}{cgerror}{$error}{/cgerror}{/if}
{foreach from=$items item=entry}
<div class="CGBlogSummary col-sm-4 col-xs-12">
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
{if $field->type == 'image'}
<div class="CGBlogSummaryField" id="CGBlogHomeImage">
{assign var=path value=$entry->file_location}
{assign var=image value=$field->value}
<a href="{$entry->detail_url}" title="{$entry->title|escape:htmlall}">
<img alt="{$entry->title|escape:htmlall}" src="{CGSmartImage notag="1" src1=$path src2=$image filter_croptofit="400,250,c"}"/>
<span class="image-overlay">
<span class="overlay-icon"><i class="fa fa-file-text"></i></span>
</span>
</a>
{if $entry->fields.image_caption }
<small>{$entry->fields.image_caption->value}</small>
{/if}
</div>
{else}
{/if}
{/foreach}
{/if}
....snip more field sections...
{/foreach}
<!-- End CGBlog Display Template -->