• Resolved kubiq

    (@kubiq)


    Hello,

    thank you for a great plugin! I’ve tried ShortPixel, Imagify and Optimole but they have limits and often make images ugly… but your plugin use only localhost for converting, so there are no limits in your plugin – amazing ??

    I also really like that you use .htaccess rewrite and you also didn’t forget about expire headers!

    BUT 1 question/problem:

    What if I need to optimize images out of WP media library? Sometimes there are images in themes, or in my case – Me, as a developer coding custom themes, I use plugin Fly Dynamic Image Resizer which allows me to generated only needed sizes for only needed images on only needed places – great stuff, you should check it.
    So I’m curious if there is possibility to create something similar as other plugins have, to “optimize directory selected by user”, so I will be able to optimize /themes/MY_THEME/images/ or /uploads/fly-images/

    That will be gamechanger for me! ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter kubiq

    (@kubiq)

    ok, maybe I have solution for Fly images, but can you help me please?
    I have no idea how to make it works, it always says Fatal error: Uncaught Error: Class ‘Regenerate’ not found in

    add_action( 'fly_image_created', 'fly_images_to_webp', 10, 2 );
    function fly_images_to_webp( $attachment_id, $fly_file_path ){
    	$webp_core = ABSPATH . 'wp-content/plugins/webp-converter-for-media/app/Regenerate/Regenerate.php';
    	if( file_exists( $webp_core ) ){
    		include_once ABSPATH . 'wp-content/plugins/webp-converter-for-media/app/Convert/Directory.php';
    		include_once ABSPATH . 'wp-content/plugins/webp-converter-for-media/app/Convert/Gd.php';
    		include_once ABSPATH . 'wp-content/plugins/webp-converter-for-media/app/Convert/Imagick.php';
    		include_once $webp_core;
    		$webp = new Regenerate();
    		$data = $webp->convertImages( array( $fly_file_path ) );
    	}
    }
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @kubiq,

    Thank you for your message and kind words. It really helps in developing the plugin.

    My plugin doesn’t take images from /wp-content/uploads/ directory and doesn’t compress them. The plugin takes images when you upload them to WordPress or generate custom image sizes. At this time, it compresses and saves to another directory.

    If your plugin is doing something in its directory, unfortunately at the moment it is hard to support it.

    Thread Starter kubiq

    (@kubiq)

    Ok, I probably found solution for Fly images, I just need small help, after lots of googling and trying I have no idea how to do it ??

    I just need to call your function in my hook.
    I need to use same code as you in /app/Regenerate/Endpoints.php in function convertImages there is:

    $api    = new Regenerate();
    $data   = $api->convertImages($params['paths']);

    I’ve tried to call it as:

    require_once ABSPATH . 'wp-content/plugins/webp-converter-for-media/app/Convert/Directory.php';
    require_once ABSPATH . 'wp-content/plugins/webp-converter-for-media/app/Convert/Gd.php';
    require_once ABSPATH . 'wp-content/plugins/webp-converter-for-media/app/Convert/Imagick.php';
    require_once ABSPATH . 'wp-content/plugins/webp-converter-for-media/app/Regenerate/Regenerate.php';
    $api = new Regenerate();
    $data = $webp->convertImages( $images_paths );

    but I have no experience with this ‘autoload’, ‘namespace’ and ‘use’ stuff…
    What should I include/require to make $api = new Regenerate(); $data = $webp->convertImages( $images_paths ); works?

    Hope you can help with this ??
    Thank you

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Regarding your code @kubiq, it doesn’t work that easily – please read informations about Composer and autoload. You can’t just take one class.

    Thread Starter kubiq

    (@kubiq)

    Then I think it’s bad idea to use composer or autoload ??
    Ok, thanks anyway… I will have to probably create my own plugin for WebP conversion

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Thank you for contact!

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @kubiq Do not use these support topics to promote your own www.ads-software.com plugin again. I have removed your reply.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fly Dynamic Image Resizer’ is closed to new replies.