Page MenuHomeIn-Portal Phabricator

INP-1878 - Add support for the WEBP format
AcceptedPublic

Authored by alex on Wed, Oct 16, 7:31 AM.

Details

Reviewers
erik
Test Plan

Preparations

  • in IDE:
    1. open modules/custom/units/widgets/widgets_config.php file for editing
    2. add the ;*.webp to the file_types property of the Image field declaration
    3. save changes
    4. open modules/custom/admin_templates/widgets/widget_list.tpl file for editing
    5. change grid_image_td block contents to:
output format kept:
<img src="<inp2:Field name='$field' format='resize:120x120'/>" <inp2:Field name='$field' format='resize:120x120;img_size' no_special='1'/> alt=""/><br />

output format set to webp:
<img src="<inp2:Field name='$field' format='resize:120x120;output_format:webp'/>" <inp2:Field name='$field' format='resize:120x120;output_format:webp;img_size' no_special='1'/> alt=""/><br />

output format set to jpeg:
<img src="<inp2:Field name='$field' format='resize:120x120;output_format:jpg'/>" <inp2:Field name='$field' format='resize:120x120;output_format:jpg;img_size' no_special='1'/> alt=""/><br />

output format set to webp + no resize:
<img src="<inp2:Field name='$field' format='resize:550x368;output_format:webp'/>" <inp2:Field name='$field' format='resize:550x368;output_format:webp;img_size' no_special='1'/> alt=""/><br />

Actual Test

  1. login to Admin Console
  2. go to CustomWidgets section
  3. create 1st record with sample JPG image uploaded in "Image" field
  4. confirm, that after you've chosen an image a thumbnail of correct size was displayed
  5. create 2nd record with sample WEBP image uploaded in "Image" field
  6. confirm, that after you've chosen an image a thumbnail of correct size was displayed
  7. download all images from above created records from the grid (4 images per row)
  8. confirm, that each of the images has file extension & encoding as they're supposed to have:
    • 1st image in a row - file extension & file encoding of originally uploaded file
    • 2nd image in a row - file extension & file encoding of webp
    • 3rd image in a row - file extension & file encoding of jpg
    • 3rd image in a row - file extension & file encoding of webp

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.2.x
Lint
Lint WarningsExcuse: Not fixing.
SeverityLocationCodeMessage
Warningcore/units/helpers/image_helper.php:644PHPCS.W.CodingStandard.PHP.NoSilencedErrors.DiscouragedCodingStandard.PHP.NoSilencedErrors.Discouraged
Unit
No Unit Test Coverage
Build Status
Buildable 1297
Build 1297: arc lint + arc unit

Event Timeline

alex created this revision.Wed, Oct 16, 7:31 AM
alex requested review of this revision.Wed, Oct 16, 7:31 AM
alex added a project: Restricted Project.Wed, Oct 16, 7:41 AM
erik accepted this revision.Wed, Oct 16, 8:05 AM
This revision is now accepted and ready to land.Wed, Oct 16, 8:05 AM