PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.3
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.3
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / webp / class-wpo-webp-test-run.php

class-wpo-webp-test-run.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.3, at webp/class-wpo-webp-test-run.php

63 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('WPO_VERSION')) die('No direct access allowed');
4
5 use \WebPConvert\Convert\ConverterFactory;
6
7 require_once WPO_PLUGIN_MAIN_PATH . 'vendor/autoload.php';
8
9 if (!class_exists('WPO_WebP_Test_Run')) :
10 /**
11 * Test run
12 */
13 class WPO_WebP_Test_Run {
14
15 /**
16 * Get a test result object OR false, if tests cannot be made.
17 *
18 * @return object|false
19 */
20 public static function get_converter_status() {
21 $source = WPO_PLUGIN_MAIN_PATH . 'images/logo/wpo_logo_small.png';
22 $upload_dir = wp_upload_dir();
23 $destination = $upload_dir['basedir']. '/wpo/images/wpo_logo_small.webp';
24
25 $converters = array(
26 // 'cwebp',
27 'vips',
28 'imagemagick',
29 'graphicsmagick',
30 'ffmpeg',
31 'wpc',
32 'ewww',
33 'imagick',
34 'gmagick',
35 'gd',
36 );
37 $working_converters = array();
38 $errors = array();
39
40 foreach ($converters as $converter) {
41 $converter_id = $converter;
42 try {
43 $converter_instance = ConverterFactory::makeConverter(
44 $converter_id,
45 $source,
46 $destination
47 );
48 $converter_instance->doConvert();
49 $working_converters[] = $converter_id;
50 } catch (\Exception $e) {
51 $errors[$converter_id] = $e->getMessage();
52 }
53 }
54
55 return array(
56 'working_converters' => $working_converters,
57 'errors' => $errors,
58 );
59 }
60 }
61
62 endif;
63