Page 1 of 1

[NOT REALLY SOLVED] CGSmartImage Responsive images?

Posted: Fri Oct 09, 2015 6:03 pm
by thefrozen
Hi,

I don't know if I am doing something wrong or whether it is intended behaviour:
On my system, CGSmartImage resizes images, but it always resizes them to the SMALLEST size given as breakpoints.
For example:
Screen resolution: 1920x1080
Breakpoints: 200,400,600,800
Resulting image width: 200 not 800 as expected.

Is my expectation wrong or something else?

Kind regards,

thefrozen

----------------------------------------------

Cms Version: 2.0

Installed Modules:

CMSMailer: 5.2.4
AdminSearch: 1.0
FileManager: 1.5
MicroTiny: 2.0
ModuleManager: 2.0
News: 2.50
Search: 1.50
ThemeManager: 1.1.8
FormBuilder: 0.8.1.1
Captcha: 0.5.2
CGExtensions: 1.49.7
SiteMapMadeSimple: 1.2.8
CMSContentManager: 1.0
DesignManager: 1.0
Navigator: 1.0
CGSmartImage: 1.20.3


Config Information:

php_memory_limit:
max_upload_size: 100000000
url_rewriting: mod_rewrite
page_extension: .html
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Europe/Berlin
permissive_smarty: true


Php Information:

phpversion: 5.6.13-0+deb8u1
md5_function: An (Ja)
json_function: An (Ja)
gd_version: 2
tempnam_function: An (Ja)
magic_quotes_runtime: Aus (Nein)
E_STRICT: 2048
E_DEPRECATED: 8192
test_file_timedifference:
test_db_timedifference:
memory_limit: 128M
max_execution_time: 480
output_buffering: 4096
file_uploads: An (Ja)
post_max_size: 180M
upload_max_filesize: 100M
session_save_path: /var/lib/php5/sessions (1733)
session_use_cookies: An (Ja)
xml_function: An (Ja)
xmlreader_class: An (Ja)


Performance Information:

allow_browser_cache: An (Ja)
browser_cache_expiry: 60
php_opcache: An (Ja)
smarty_cache: An (Ja)
smarty_compilecheck: Aus (Nein)
smarty_cache_udt: An (Ja)
auto_clear_cache_age: Aus (Nein)

Server Information:

Server Api: apache2handler
Server Db Type: MySQL (mysqli)
Server Db Version: 5.5.44
Server Db Grants: „Alles gewähren“-Anweisung gefunden, die als geeignet scheint
Server Time Diff: Keine Abweichung der Zeit im Dateisystem gefunden


----------------------------------------------

Re: CGSmartImage Responsive images?

Posted: Fri Oct 09, 2015 8:27 pm
by JohnnyB
You might post the tag being used in the template with any other settings etc., so someone can help better.

Re: CGSmartImage Responsive images?

Posted: Fri Oct 09, 2015 8:59 pm
by thefrozen
Thanks, I didn't post settings and other details because I just wanted to know whether my expectation is the problem. But you are right, to receive help, more is probably needed. So here the settings:

Template in the <head>:

Code: Select all

{CGSmartImage action=responsive}
Code in the content block:

Code: Select all

{CGSmartImage src="path_to_image.png" alt="alttext"}
Settings:
Responsiveness is enabled.
Assume responsive cookie is not enabled.
Breakpoints: 200,400,600,800

Cache path is set and works fine.
Default autoscale filter is "resize".

Thanks!

Kind regards,

thefrozen

Re: CGSmartImage Responsive images?

Posted: Tue Oct 13, 2015 1:17 pm
by thefrozen
Edit: See below!

I found a solution. By examining the code I found that max_width or max_height has to be defined. According to the module help this is only possible for csgi_convert. So I edited my template and added

Code: Select all

{cgsi_convert max_width="800"}{content}{/cgsi_convert}
instead of just

Code: Select all

{content}
.
After changing the image link to plain HTML image tags instead of {CGSmartImage} it worked as intended. Awesome!

So for others seeing this confusing problem:
Make sure that you set max_width (or max_height) to a good value. To do this, use cgsi_convert in the template.

Edit:
Unfortunately this fixes the width to 750 but still doesn't resize.
Looking closer at the code I suspect a typo:
Line 620 in class.cgsi_utils.php:

Code: Select all

$lval = max($opp['max_width'],$opp['max_height']);
Should this be:

Code: Select all

$lval = max($opp['d_max_width'],$opp['d_max_height']);
?
I'll try..
Answer: Nope.. Still doesn't resize. :(

Kind regards,

thefrozen

Re: [NOT REALLY SOLVED] CGSmartImage Responsive images?

Posted: Tue Oct 13, 2015 1:42 pm
by JohnnyB
Maybe check bug reports for it in the Forge in case something similar has been reported. And, if not and you think it is a bug, submit a bug report following the instructions here, http://forum.cmsmadesimple.org/viewtopic.php?f=7&t=8002 to get your bug report looked at.