Preparations
- in IDE:
- open modules/custom/units/widgets/widgets_config.php file for editing
- add the ;*.webp to the file_types property of the Image field declaration
- save changes
- open modules/custom/admin_templates/widgets/widget_list.tpl file for editing
- 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 />
- save changes
- in Web Browser:
- download sample jpg image: https://www.gstatic.com/webp/gallery/1.jpg
- download sample webp image: https://www.gstatic.com/webp/gallery/1.webp
Actual Test
- login to Admin Console
- go to Custom → Widgets section
- create 1st record with sample JPG image uploaded in "Image" field
- confirm, that after you've chosen an image a thumbnail of correct size was displayed
- create 2nd record with sample WEBP image uploaded in "Image" field
- confirm, that after you've chosen an image a thumbnail of correct size was displayed
- download all images from above created records from the grid (4 images per row)
- 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