PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.20
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.20
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.20, at webp/class-wpo-webp-test-run.php

57 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 if (!class_exists('WPO_WebP_Test_Run')) :
6 /**
7 * Test run
8 */
9 class WPO_WebP_Test_Run {
10
11 /**
12 * Get a test result object OR false, if tests cannot be made.
13 *
14 * @return object|false
15 */
16 public static function get_converter_status() {
17 $source = WPO_PLUGIN_MAIN_PATH . 'images/logo/wpo_logo_small.png';
18 $upload_dir = wp_upload_dir();
19 $destination = $upload_dir['basedir']. '/wpo/images/wpo_logo_small.png.webp';
20
21 $converters = array(
22 // 'cwebp',
23 'vips',
24 'imagemagick',
25 'graphicsmagick',
26 'ffmpeg',
27 'wpc',
28 'ewww',
29 'imagick',
30 'gmagick',
31 'gd',
32 );
33 $working_converters = array();
34 $errors = array();
35
36 foreach ($converters as $converter) {
37 $converter_id = $converter;
38 try {
39 WPO_WebP_Utils::perform_webp_conversion($converter_id, $source, $destination);
40 $working_converters[] = $converter_id;
41 // Copying source file to `uploads` folder. To be used test redirection
42 // We're doing it here, to make sure folders already exists `/wpo/images/`
43 copy($source, $upload_dir['basedir'] . '/wpo/images/wpo_logo_small.png');
44 } catch (\Exception $e) {
45 $errors[$converter_id] = $e->getMessage();
46 }
47 }
48
49 return array(
50 'working_converters' => $working_converters,
51 'errors' => $errors,
52 );
53 }
54 }
55
56 endif;
57