Settings Page Image Output Stuck in 150x150 Configuration

Support MB Settings Page Settings Page Image Output Stuck in 150x150 ConfigurationResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26988
    jackp317jackp317
    Participant

    Hi,

    I was following this tutorial and I'm having an issue with the image output. The png image that I'm testing is stuck in a 150x150 configuration.

    When outputted, the image source shows 150x150 when the image uploaded on the settings page is 1538x507 pixels. Not sure what is causing this. I noticed that the tutorial uses a square logo so it isn't affected, but my horizontal logo is.

    Code used:

    /* Get the URL of logo image from the settings page */
    function wpdd_get_mb_settings_logo_url( $field_id ) {
        $logo = rwmb_meta( 'company_logo', ['object_type' => 'setting'], 'company_options' );
        return $logo ? $logo['url'] : 'http://placehold.it/1600x900';
    }

    Here is the outputted page source:
    <img id="image-383-1283" alt="" src="https://test3.credizo.io/wp-content/uploads/sites/8/2021/04/Cybba_Logo_Color-150x150.png" class="ct-image">

    Here is the logo added to the settings page:
    Logo

    Any ideas how to not restrict the image output to 150x150 and remove that from the image file path?

    Thanks,
    Jack

    #26999
    Long NguyenLong Nguyen
    Moderator

    Hi Jack,

    Thank you for reaching out.

    By default, the size of the image is thumbnail, you can see the list WordPress thumbnail sizes here https://developer.wordpress.org/reference/functions/the_post_thumbnail/#user-contributed-notes.

    You can change the image URL by using another size

    $logo = rwmb_meta( 'company_logo', ['object_type' => 'setting', 'size' => 'medium'], 'company_options' );
    

    Or use the key full_url to get the full size of the image.

    return $logo ? $logo['full_url'] : 'http://placehold.it/1600x900';
    

    Get more details on this documentation https://docs.metabox.io/fields/single-image/#template-usage.

    #27010
    jackp317jackp317
    Participant

    Awesome. Thank you!

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