Skip to content

Commit

Permalink
Merge pull request #110 from tbela99/convert_inline_css_images
Browse files Browse the repository at this point in the history
add an option to enable the feature #93
  • Loading branch information
tbela99 authored Sep 20, 2020
2 parents 3ca0682 + 0cea25d commit c486430
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions gzip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@
<option value="1">JYes</option>
<option value="0">JNo</option>
</field>
<field name="inlineimageconvert" label="PLG_GZIP_FIELD_INLINE_IMAGE_CONVERT_LABEL" description="PLG_GZIP_FIELD_INLINE_IMAGE_CONVERT_DESCRIPTION" hint="PLG_GZIP_FIELD_INLINE_IMAGE_CONVERT_HINT" type="radio" class="btn-group" default="0">
<option value="1">JYes</option>
<option value="0">JNo</option>
</field>
<field name="imageignore" label="PLG_GZIP_FIELD_IMAGEIGNORE_LABEL" description="PLG_GZIP_FIELD_IMAGEIGNORE_DESCRIPTION" hint="PLG_GZIP_FIELD_IMAGEIGNORE_HINT" type="textarea" rows="15" cols="45" />
<field name="imagesresizestrategy" label="PLG_GZIP_FIELD_IMAGE_CROP_STRATEGY_LABEL" description="PLG_GZIP_FIELD_IMAGE_CROP_STRATEGY_DESCRIPTION" type="list" default="CROP_CENTER">
<option value="CROP_DEFAULT">JOPTION_IMAGE_RESIZE_CROP_DEFAULT</option>
Expand Down
2 changes: 1 addition & 1 deletion helpers/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function postProcessHTML ($html, array $options = []) {
}
}

if (!empty($attributes['style'])) {
if (!empty($options['inlineimageconvert']) && !empty($attributes['style'])) {

$attributes['style'] = preg_replace_callback('~url\(([^)]+)\)~', function ($matches) use($options) {

Expand Down
4 changes: 4 additions & 0 deletions language/en-GB/en-GB.plg_system_gzip.ini
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ PLG_GZIP_FIELD_IMAGE_CSS_RESIZE_DESCRIPTION=""
PLG_GZIP_FIELD_IMAGE_CONVERT_LABEL="Convert to Webp"
PLG_GZIP_FIELD_IMAGE_CONVERT_DESCRIPTION="Webp produce smaller images"

PLG_GZIP_FIELD_INLINE_IMAGE_CONVERT_LABEL="Convert Inline Background Images"
PLG_GZIP_FIELD_INLINE_IMAGE_CONVERT_DESCRIPTION="Convert inline css background images"
PLG_GZIP_FIELD_INLINE_IMAGE_CONVERT_HINT="Convert background images in inline Css"

PLG_GZIP_FIELD_IMAGEIGNORE_LABEL="Ignore Images"
PLG_GZIP_FIELD_IMAGEIGNORE_DESCRIPTION="Images matching any of these patterns will not be optimized"
PLG_GZIP_FIELD_IMAGEIGNORE_HINT="Example: /images/optimized/"
Expand Down

0 comments on commit c486430

Please sign in to comment.