1 | | Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52Deleted because of the respectles answer from @desrosj in comment # 52 |
| 1 | I found a code to add a plugin which enables webp. Think that is the base, but there is much more needed to handle webp. Especially in Gutenberg there need to be block settings for it. The question for me is if it will be handled within an image block or as an own block. An own block would offer more possibilities. |
| 2 | |
| 3 | |
| 4 | {{{ |
| 5 | <?php |
| 6 | /** |
| 7 | * Plugin Name: WEBP Enabling |
| 8 | * Plugin URI: |
| 9 | * Description: WEBP Enabling |
| 10 | * Version: 1.0 |
| 11 | * Author: Sven Esser |
| 12 | * Author URI: |
| 13 | * Functions Included: webp_upload_mimes, webp_is_displayable |
| 14 | **/ |
| 15 | |
| 16 | //** *Enable upload for webp image files.*/ |
| 17 | function webp_upload_mimes($existing_mimes) { |
| 18 | $existing_mimes['webp'] = 'image/webp'; |
| 19 | return $existing_mimes; |
| 20 | } |
| 21 | add_filter('mime_types', 'webp_upload_mimes'); |
| 22 | |
| 23 | //** * Enable preview for webp image files.*/ |
| 24 | function webp_is_displayable($result, $path) { |
| 25 | if ($result === false) { |
| 26 | $displayable_image_types = array( IMAGETYPE_WEBP ); |
| 27 | $info = @getimagesize( $path ); |
| 28 | |
| 29 | if (empty($info)) { |
| 30 | $result = false; |
| 31 | } elseif (!in_array($info[2], $displayable_image_types)) { |
| 32 | $result = false; |
| 33 | } else { |
| 34 | $result = true; |
| 35 | } |
| 36 | } |
| 37 | return $result; |
| 38 | |
| 39 | } |
| 40 | add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2); |
| 41 | ?> |
| 42 | }}} |