CGSmartImage output blank, how to diagnose?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
severtki
Forum Members
Forum Members
Posts: 24
Joined: Tue Aug 11, 2009 1:33 pm

CGSmartImage output blank, how to diagnose?

Post by severtki »

I'm on CMS 2.2.2, all modules current as of today (7/14/17 -- complete info attached). CGSmartImage ver =1.21.9. The code and template below all worked until my recent upgrade to 2.2.2 and current versions of all modules installed.

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 -->

Attachments

[The extension txt has been deactivated and can no longer be displayed.]

severtki
Forum Members
Forum Members
Posts: 24
Joined: Tue Aug 11, 2009 1:33 pm

Re: CGSmartImage output blank, how to diagnose?

Post by severtki »

Quick follow-up: I note that I can replace the image tag with this:

Code: Select all

<img alt="{$entry->title|escape:htmlall}" src="{$path}/{$image}"/>
and it works correctly.

Does this have something to do with the changes to smarty scoping in 2.2?

Thanks,
Kirk
severtki
Forum Members
Forum Members
Posts: 24
Joined: Tue Aug 11, 2009 1:33 pm

[solved] CGSmartImage output blank, how to diagnose?

Post by severtki »

Problem solved, I think: the settings for CGSmartImage cache were blank, perhaps cleared in the process of the upgrade??

If anyone else has this problem, to correct: Extensions / Calguys Smart Image Toolkit / General tab. Check the "Cache Path:" which was blank for me and "Maximum Cache File Age (days):" which was 0.

[I don't seem to have an edit button, or I would mark the subject of the first post as [solved]...]
Locked

Return to “Modules/Add-Ons”