CMS MADE SIMPLE FORGE

CGSmartImage

 

[#8729] cgsi_convert sizing issues

avatar
Created By: Peter Stubbs (applejack1923)
Date Submitted: Sat Dec 08 09:37:10 -0500 2012

Assigned To: Robert Campbell (calguy1000)
Version: 1.9.5
CMSMS Version: None
Severity: Minor
Resolution: Invalid
State: Closed
Summary:
cgsi_convert sizing issues
Detailed Description:
I am trying to use cgsi_convert for an image tag to set a fixed width and
variable height. filter_resize works but doesn't over ride the width and height
attributes of the img tag. The only way to over ride them is by setting a
max_width attribute but then it doesn't scale the height which needs to be
variable. I have tried using the width tag but it has not effect.

{cgsi_convert filter_resize='w,100' width='100' quality='100'}<img
src="uploads/images/image.jpg" alt="" width="640" height="478" />{/cgsi_convert}


History

Comments
avatar
Date: 2012-12-08 12:22
Posted By: Robert Campbell (calguy1000)

a:  {cgsi_convert} is slow and inefficient for wrapping around a single image.  
Use the {CGSmartImage} tag
b:  you are specifying a filter_resize, and a width filter... the second will
probably override the first.
      
avatar
Date: 2012-12-08 12:46
Posted By: Peter Stubbs (applejack1923)

Ok thanks. Re the width I did try lots of different options.

If the image is uploaded via the WYSIWYG editor then can CGSmartImage strip out
the img src code and just leave the url. If so how, is this what the notag
option does?


      
avatar
Date: 2012-12-08 12:55
Posted By: Peter Stubbs (applejack1923)

Ok guess not just tried the notag option.

For clients rather than using file upload I usually get them to upload using the
WYSIWYG editor that way they can see the image so CGSmartImage needs to be able
to strip the code and just leave the URL. I have written a reg_replace function
but this would be a useful addition to this module.
      
avatar
Date: 2013-02-20 03:44
Posted By: Robin (Cerulean)

I'd like to second this request.

As I understand it, the idea behind the {cgsi_convert} tag is to automatically
resize/process images in the {content} block. Which is a very useful feature.
But images added by the WYSIWYG (TinyMCE and MicroTiny) get Width and Height
attributes added automatically to the img tag. It seems that when {cgsi_convert}
finds images with Width and Height attributes on the image tag the width
attribute doesn't work.

So...

{cgsi_convert width="200"}
<img src="myimage.jpg"  />
{/cgsi_convert}
does work

{cgsi_convert width="200"}
<img src="myimage.jpg" width="600" height="400" />
{/cgsi_convert}
does not work

      
avatar
Date: 2013-02-20 18:10
Posted By: Robin (Cerulean)

I decided to follow applejack1923's method and strip out the width and height
attributes from the {content} block using regex_replace.

For anyone else wanting to do this, here is the code:

{content assign="page_content"}
{cgsi_convert width=600}
{$page_content|regex_replace:"/(width|height)=\"\d*\"\s/":""}
{/cgsi_convert}
      
Updates

Updated: 2013-08-30 23:52
cmsms_version_id: 29495 => -1
state: Open => Closed

Updated: 2012-12-08 12:22
resolution_id: => 9
severity_id: 2 => 3