Skip to content

Pass _do_image_action public #11

@Rahe

Description

@Rahe

Hello,

On some cases it can be usefull to call the optimus API for optimizing files from the filesystem.
For example here i'm using the "wpthumb" plugin for generating all the images sizes on the fly.

But this is not generating files for the webP only the png/jpg ones, but with only this lines of code :

<?php 
add_action( 'wpthumb_saved_cache_image', function( WP_Thumb $wpthumb ) {
	$file_path = $wpthumb->getCacheFilePath();
	Optimus_Request::_do_image_action($file_path, array(
            'file' => $wpthumb->getCacheFileURL(),
            'webp' => true
        ));
} );

I'm able to generate a webP version on the fly for our ressource, and with the right .htaccess rules the file is switched from png/jpg to the webP version :).

Is it possible to offer an API for optimizing any image file from the filesystem like the _do_image_action method can, because right now this is on private so unusable and duplicating all this code is not possible for us.

Rahe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions