image.full.width returning wrong value

Support MB Views image.full.width returning wrong value

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #43073
    Liam ColmanLiam Colman
    Participant

    Hi there,

    I am trying to use the following code to display my images (this is just a part):

        <picture>
            <source type="image/avif" srcset="
                {{ item.medium.url | replace({('.' ~ item.medium.url | split('.')[item.medium.url | split('.')|length - 1]): ""}) }}.avif {{ item.medium.width }}w,
                {{ item.medium_large.url | replace({('.' ~ item.medium_large.url | split('.')[item.medium_large.url | split('.')|length - 1]): ""}) }}.avif {{ item.medium_large.width }}w,
                {{ item.nine_hundred_sixty.url | replace({('.' ~ item.nine_hundred_sixty.url | split('.')[item.nine_hundred_sixty.url | split('.')|length - 1]): ""}) }}.avif {{ item.nine_hundred_sixty.width }}w,
                {{ item.large.url | replace({('.' ~ item.large.url | split('.')[item.large.url | split('.')|length - 1]): ""}) }}.avif {{ item.large.width }}w
                {{ item.full.url | replace({('.' ~ item.full.url | split('.')[item.full.url | split('.')|length - 1]): ""}) }}.avif {{ item.full.width }}w,
                " sizes="(min-width: 769px) 80vw, 96vw"
            />
    

    For some reason, `{{ item.large.width }}' is outputting 857 on the frontend, despite it being 1780. Any idea on why this is happening?

    #43082
    PeterPeter
    Moderator

    Hello Liam,

    You can go to the folder /wp-content/uploads/year/month/ and check the actual large dimension (width and height) of the image after uploading to WordPress and being cropped.

    #43086
    Liam ColmanLiam Colman
    Participant

    Hi there,

    The image is 1780*1440.

    #43095
    PeterPeter
    Moderator

    Hello,

    Please share your site credentials via this contact form https://metabox.io/contact/
    I will take a closer look.

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