#39244 Bug Report – Featured Image Sizes

Landing Forums JupiterX WordPress Theme Bug Report – Featured Image Sizes

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • Jesus Antolin

    Hi JupiterX Team,

    Recently, I noticed the following behavior on blog posts:

    <picture><source media=”(max-width: px)” srcset=”https://.com/wp-content/uploads/2019/12/blog-feature-004.jpg”><source media=”(max-width: px)” srcset=”https://.com/wp-content/uploads/2019/12/blog-feature-004.jpg”&gt;bg4</picture>

    As you can see, the srcset is not correct as it points to the same file instead of dynamically created smaller copies of the uploaded image.

    I found a Jupiter X funcion caling wp_get_image_editor to create these extra images, however, it is passing the URL instead of the actual path, causing WordPress function to fail.

    The affected file is class-image-editor.php

    I changed the code so that file path is passed instead and it worked.

    Thanks.

    Regards.

    Jesus Antolin

    To add more clarity to this:

    The piece of code which I had to change in \jupiterx\lib\api\image:

    Original:

    public function __construct( $attachment_id, $src, array $args, $output = 'STRING' ) {
    $local_source = jupiterx_url_to_path( $this->src );
    $this->attachment_id = $attachment_id;
    $this->src = file_exists( $local_source ) ? $local_source : $src;
    $this->args = $args;
    $this->output = $output;
    $this->rebuilt_path = $this->rebuild_image_path();
    }

    Changed:

    public function __construct( $attachment_id, $src, array $args, $output = 'STRING' ) {
    $local_source = jupiterx_url_to_path( $src );
    $this->attachment_id = $attachment_id;
    $this->src = file_exists( $local_source ) ? $local_source : $src;
    $this->args = $args;
    $this->output = $output;
    $this->rebuilt_path = $this->rebuild_image_path();
    }

    Interesting thing is that is is actually fixed in the original Beans file: https://github.com/Getbeans/Beans/blob/development/lib/api/image/class-beans-image-editor.php

    Hope this helps.

    Thanks.

    Regards.

    Tatyana Hutsol Support Team

    Hello,

     

    Thank you for sharing the fix.

    We’ll take it into account.

     

    Regards.

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login