CMS MADE SIMPLE FORGE

CGSmartImage

 

[#11988] Since CGSmartImage v1.22.5 the width and height attributes are missing from the <img> tag.

avatar
Created By: Deleted User (deleteduser_11200)
Date Submitted: Thu Mar 14 08:00:29 -0400 2019

Assigned To: Robert Campbell (calguy1000)
Version: 1.22.5
CMSMS Version: None
Severity: None
Resolution: None
State: Open
Summary:
Since CGSmartImage v1.22.5 the width and height attributes are missing from the tag.
Detailed Description:
I upgrade CGSmartImage from v1.22.4 to v1.22.5 suddenly images scaled with
CGSmartImage do not have a width and height attribute anymore:


This is normal behaviour when using the "noauto" parameter: "CGSmartImage will
normally automatically fill the width and height attributes of the generated img
tag with the size of the image generated from the last filter. the noauto
parameter can prevent this.". In my testcase I did not use the noauto parameter.


======= Test case:

{CGSmartImage src=$images[0]->file notag=0 filter_resize='w,100'  noauto=1
noembed=1}
{CGSmartImage src=$images[0]->file notag=0 filter_resize='w,100'  noauto=0
noembed=1}
{CGSmartImage src=$images[0]->file notag=0 filter_resize='w,100'  noembed=1}


======= Why does this happen?

Some how setting the width and height is commented out in CGSmartImage v1.22.5 :
/modules/CGSmartImage/lib/class.cgsi_utils.php line 880 in v1.22.4 this was not
the case.


/*
                 not needed now.
               if( $dest_fname && !$opp['noauto'] ) {
                   $details = getimagesize($dest_fname);
                   if( is_array($details) ) {
                       $outp['width']  = (int)$details[0];
                       $outp['height'] = (int)$details[1];
                   }
               }
               */

=======  Solution:
- code fix  or rollback to v1.22.4



History

Comments
avatar
Date: 2020-06-23 12:04
Posted By: Franck (knarf)

Confirmed. 
I had to add noauto=1 for some images (not all) to display with the correct
ratio / size. Otherwise, some images were added width and height parameters with
no relation to actual size.