Make WordPress Core

Changes between Version 15 and Version 16 of Ticket #35725, comment 27


Ignore:
Timestamp:
11/17/2020 06:33:36 AM (3 years ago)
Author:
dd32
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35725, comment 27

    v15 v16  
    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
     1I 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.*/
     17function webp_upload_mimes($existing_mimes) {
     18$existing_mimes['webp'] = 'image/webp';
     19return $existing_mimes;
     20}
     21add_filter('mime_types', 'webp_upload_mimes');
     22
     23//** * Enable preview for webp image files.*/
     24function webp_is_displayable($result, $path) {
     25if ($result === false) {
     26$displayable_image_types = array( IMAGETYPE_WEBP );
     27$info = @getimagesize( $path );
     28
     29if (empty($info)) {
     30$result = false;
     31} elseif (!in_array($info[2], $displayable_image_types)) {
     32$result = false;
     33} else {
     34$result = true;
     35}
     36}
     37return $result;
     38
     39}
     40add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);
     41?>
     42}}}