Problem/Motivation

Allow users to upload and manage images of Google's image format, WebP (https://developers.google.com/speed/webp)

Steps to reproduce

- Add webp as allowed extension
- Allow to use Image GD Toolkit's imagecreatefromwebp() function

Proposed resolution

Remaining tasks

None.

User interface changes

Nothing.

API changes

Nothing.

Data model changes

Release notes snippet

Allow users to use images with .webp extension.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danyg created an issue. See original summary.

danyg’s picture

Here is my patch which allows the users to use webp extension for image upload fields and works with built-in image styles.

VasyOK’s picture

Thank you danyg! Patch worked. But after after node save i see:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_slideimage_width' at row 1: INSERT INTO {field_data_field_slideimage} (entity_type, entity_id, revision_id, bundle, delta, language, field_slideimage_fid, field_slideimage_alt, field_slideimage_title, field_slideimage_width, field_slideimage_height) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 24 [:db_insert_placeholder_2] => 24 [:db_insert_placeholder_3] => slide [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 36 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => [:db_insert_placeholder_10] => ) в функции field_sql_storage_field_storage_write() (строка 610 в файле /home/u8615/domains/moybuhgalter.com.ua/modules/field/modules/field_sql_storage/field_sql_storage.module).

danyg’s picture

@VasyOK The WebP support of getimagesize() function was implemented in PHP 7.1.0
In older PHP versions getimagesize() cannot recognize the webp filetypes (This is what I just discovered last week).
Can you confirm that the PHP version is older in your site? If not, we should figure out what's wrong.

VasyOK’s picture

today php 5.6
ok i try to update php version
thanx, danyg!

mitthukumawat’s picture

I have applied the patch #2 in drupal 7.80 and checked the support of webp images.

Testing steps:

  1. installed drupal 7.80.
  2. Added webp file extension in image field of article content type.
  3. Created an article content where I have uploaded .webp image.
  4. Webp image appearing fine for me.

Adding after patch screenshots for reference.

mitthukumawat’s picture

Status: Needs review » Reviewed & tested by the community
poker10’s picture

Patch looks good. Adding a related issue as if that backport gets commited with any luck, then we should be able implement more generic solution, instead of this hardcoded one (such as the one currently present in D8/9).

Until that this patch works for us on PHP 7.1+

poker10’s picture

mgifford’s picture

Issue tags: +sustainability, +Performance, +image
poker10’s picture

Status: Reviewed & tested by the community » Postponed
mgifford’s picture

Version: 7.x-dev » 10.3.x-dev
Status: Postponed » Active
Issue tags: +avif

I don't know why we're trying to add this to D7 at this point. Bumping it up to D10. Hopefully we don't have to wait till 11.

AVIF & WebP are already ready to roll:
https://caniuse.com/?search=avif
https://caniuse.com/?search=webp

poker10’s picture

Title: Add webp support for core image module » [D7] Add webp support for core image module
Version: 10.3.x-dev » 7.x-dev

As far as I know, D10 currently supports WebP without the need of any additional module, so this is only a D7 issue. The original issue is here: #2340699: Let GDToolkit support WEBP image format

D10/11 Avif issue is here: #3202016: Let GDToolkit support AVIF image format.

I agree that it is possible, that this would not move anywhere until the EOL, but let's keep the relevant issues open until then. Thanks!