Page 1 of 1

[Solved] CGSmartImage only visible to Admin

Posted: Fri Jan 22, 2016 5:50 pm
by clapczyn
Hi everyone,

i've got a really strange problem and I cant find any solution for it.
CGSmartImage doesn't show any images except when I'm logged in as admin in the same browser that views the page.

As soon as I'm logged in the cache-directory fills up upon pagevisits (and the images load) When I log out and clear my browser cache the images won't show.

There is nothing shown on the page, but in the Admin Log it says "A required parameter was missing or invalid: src"
The module-call that looks like this (and works when logged in):

Code: Select all

{capture assign="content_img_url"}
{content_image label='ContentImage' block='content_image' dir='contentpage' urlonly='true'}{/capture}
{CGSmartImage src=$content_img_url filter_croptofit="264,259"}
In CGSmartImage the following options are set:
Responsive – everything on NO
Embedding - Smart, 32kb
General:
Force file extension: YES
CachePath – uploads/_CGSmartImage
Suppress Errors – NO
preemptive memory check – NO

Anything that helps is appreciated – I just don't know where to go from here …

THX alot!

----------------------------------------------
Cms Version: 2.1.1
Installed Modules:
AdminSearch: 1.0
CMSContentManager: 1.1
DesignManager: 1.1.1
FileManager: 1.5.2
MenuManager: 1.50.2
MicroTiny: 2.0.2
ModuleManager: 2.0.1
Navigator: 1.0.2
LISE: 1.1
Search: 1.50.2
CGExtensions: 1.51.1
CGSmartImage: 1.21
SiteMapMadeSimple: 1.2.8
LISE: 1.1

Config Information:
php_memory_limit:
max_upload_size: 128000000
url_rewriting: none
page_extension:
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Asia/Singapore
permissive_smarty: false

Php Information:
phpversion: 5.5.31
md5_function: On (True)
json_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 2048
E_DEPRECATED: 0
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 128M
max_execution_time: 30
register_globals: Off (False)
output_buffering: On
disable_functions:
open_basedir:
test_remote_url: Success
file_uploads: On (True)
post_max_size: 128M
upload_max_filesize: 128M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
check_ini_set: On (True)
curl: On

Performance Information:
allow_browser_cache: On (True)
browser_cache_expiry: 60
php_opcache: Off (False)
smarty_cache: On (True)
smarty_compilecheck: Off (False)
smarty_cache_udt: On (True)
auto_clear_cache_age: On (True)
Server Information:
Server Software: Apache
Server Api: cgi-fcgi
Server Os: Linux 3.14.25-grsec.3.el5 On x86_64
Server Db Type: MySQL (mysql)
Server Db Version: 5.5.40
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable

Permission Information:
tmp: /home/site5/public_html/tmp (0755)
tmp_cache: /home/site5/public_html/tmp/cache (0755)
templates_c: /home/site5/public_html/tmp/templates_c (0755)
modules: /home/site5/public_html/modules (0755)
uploads: /home/site5/public_html/uploads (0755)
File Creation Mask (umask): /home/site5/public_html/tmp/cache (0755)
config_file: 0444
----------------------------------------------

Re: CGSmartImage only visible to Admin

Posted: Fri Jan 22, 2016 7:25 pm
by Dr.CSS
Sounds like the src= is coming up blank, have you tried just using the assign= in the {content_image} tag..?

Re: CGSmartImage only visible to Admin

Posted: Fri Jan 22, 2016 7:35 pm
by calguy1000
As DrCss mentioned you shouldn't be using the {capture} tag unless absolutely necessary.

But I think the problem you are having is related to smarty caching.

Re: CGSmartImage only visible to Admin

Posted: Fri Jan 22, 2016 8:35 pm
by calguy1000
To follow up.... I think I see what is happening, and you will need a bit more understanding in how smarty caching works.

Generally, it converts your smarty template to cacheable text.

i.e: the stuff that is cached will be the results to {somecall}

Given this code:
{content_image block='foo' assign='foo'}
{CGSmartImage src=$foo}

The first line outputs no data... so there is nothing to cache.
The second line assumes that there is data in the smarty $foo variable, and generates an error.

Now. the nocache attribute to smarty plugins can be useful in bypassing cache in some circumstances.

so I would try
{content_image block=foo assign=foo nocache}
{CGsmartImage src=$foo}

Re: CGSmartImage only visible to Admin

Posted: Fri Jan 22, 2016 8:41 pm
by clapczyn
That did the trick, thanks a lot!!!
I would've never thought of that …

[Edit]
though I still don't understand why it worked when I was logged in ???

Re: [Solved] CGSmartImage only visible to Admin

Posted: Fri Jan 22, 2016 8:52 pm
by calguy1000
though I still don't understand why it worked when I was logged in ???
Because when you are logged in to the admin (in the same browser session) caching is explicitly disabled. This is so that you can immediately see changes that you implement.