All images 64x64px – please help

All Images where I let WordPress render the html img -tag have the wrong size (64x64px), no matter what size i tell wp to use.

I upload an image with dimensions 320×320 pxThen I use this line of code

`<?php$image = 1368;echo wp_get_attachment_image($image, ‘full’)?>`

where `$image` equals the image id as seen in wp media library;

I would expect to get the full 320x320px image. But i do get a 64x64px image:

`<img width=”64″ height=”64″ src=”`[`https://[…]/wp-content/uploads/2022/08/Rectangle-16.png`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16.png)`” class=”attachment-320×320 size-320×320″ alt=”” loading=”lazy” srcset=”`[`https://`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16.png)`[`[`…]`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16.png)[`/wp-content/uploads/2022/08/Rectangle-16.png`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16.png) `370w,` [`https://`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16-300×300.png)[`[…]`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16.png)[`/wp-content/uploads/2022/08/Rectangle-16-300×300.png`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16-300×300.png) `300w,` [`https://`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16-150×150.png)[`[…]`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16.png)[`/wp-content/uploads/2022/08/Rectangle-16-150×150.png`](https://ischebeck.iglu.media/wp-content/uploads/2022/08/Rectangle-16-150×150.png) `150w” sizes=”(max-width: 64px) 100vw, 64px”>`

(I Removed the domainname here for illustrative purposes.)

Img ist displayed in 64x64px on each viewport.The used source is always the smallest (150×150)

Same happens for each registered image size and as well when I use a distinct array with size -values e.g.

`<?php echo wp_get_attachment_image($image, array(320,320)) ?>`

I guess wordpress gets the content of the `sizes` \-attribute on the `img` tag wrong, but why? And how to fix that?

I tried setting the `$content_width` variable inside functions.php to values between 320 and 1800 without any effect.

What am I doing wrong?

2 Comments
  1. One more info. When I fetch the image source

    `print_r(wp_get_attachment_image_src($image, ‘full’)`

    I do get this:

    `Array (`
    `[0] => https://[…]/wp-content/uploads/2022/08/Rectangle-16-1.png`
    `[1] => 64`
    `[2] => 64`
    `[3] =>`
    `)`

  2. AllI can think is, that the original full size? Is set at 64 x 64 pixels. The 2nd parameter being an image size name, so can you double check your functions file? To see whats registered?

    &#x200B;

    [https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/](https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/)

    &#x200B;

    You can also pass an array of a size into it also (not just the image name), have you tried that?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here