Support » Plugin: ResizeFly » Fix for gutenberg

  • Resolved lennardv

    (@lennardv)


    Hi there,

    This plugin didn’t work inside gutenberg editor for me. I found it didn’t create resizefly urls when creating content with images. On the rendered page it worked. Inside the editor it gave a 404 on images.

    I fixed this by adding filters to run() in src/Upload/Filter.php:

    
    // add resizefly url before loaded into gutenberg
    add_filter( 'rest_prepare_page', [$this, 'urlInRestResponse'], 10, 1 );
    add_filter( 'rest_prepare_post', [$this, 'urlInRestResponse'], 10, 1 );
    

    And creating this function in Filter.php:

    
    /**
     * @param WP_REST_Response $res
     *
     * @return WP_REST_Response
     */
    public function urlInRestResponse($res)
    {
        if (!empty($res->data['content']['raw'])) {
            $res->data['content']['raw'] = $this->urlInHtml($res->data['content']['raw']);
        }
            
        return $res;
    }
    

    Could you merge this or a similar fix?

    Thanks,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author alpipego

    (@alpipego)

    Thank you for raising this issue and also providing a potential fix.

    Unfortunately, I can’t reproduce the issue; could you maybe provide a minor test case or give me more information in which block this occurs?

    Could you please also dump the current options for ResizeFly?
    SELECT option_name, option_value FROM wp_options WHERE option_name LIKE "resizefly%";

    Thank you.

    Ok,

    Hmh i cant seem to reproduce it with all images. Some existing images that i imported in the library programmatically go wrong and some new images which i manually upload that are quite small and get upsized in the editor.

    For now, i’ll use my fix in functions.php and assume this problem is specific to me.

    Thanks!

    Plugin Author alpipego

    (@alpipego)

    Thanks for the reply, I’ll look into the image upscaling issue and will get back to you.

    • This reply was modified 1 year, 4 months ago by alpipego.
    Plugin Author alpipego

    (@alpipego)

    I’ve opened this issue on Github: https://github.com/alpipego/resizefly/issues/15, to further look into it, if something comes up, I’ll add it here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fix for gutenberg’ is closed to new replies.