Home Forums Front-end Issues Image array won\'t output custom image sizes


Image array won\'t output custom image sizes

  • Hi Folks,

    I’ve been using ACF for awhile and I haven’t seen this error before.

    There’s an image field registered in a repeater that I’m trying to output custom thumbnail sizes for.

    Here’s a simplified version of the code I’m using to call the thumbnail size. The image is set to ‘Image array’ in ACF (and yes, the thumbnail size has been registered and those sizes all exist. I already double checked that one):

    <img src="<?php echo $image['sizes']['thumb-small']; ?>" />

    Here are the ACF settings for the field:
    ACF settings for malfucntioning image field

    I then troubleshot the image by checking its variables, and that’s when things got interesting. I printed out all the thumbnails…and they all link to the same image. So even though the thumbnails exist in the correct sizes in the WP uploads folder, ACF isn’t linking to them. Here’s the first portion of the code:

        [ID] => 1411
        [id] => 1411
        [title] => services_banner
        [filename] => services_banner.png
        [url] =>
        [alt] => Services Alt text
        [author] => 4
        [description] => 
        [caption] => 
        [name] => services_banner
        [date] => 2016-03-13 02:57:20
        [modified] => 2017-10-19 21:47:19
        [mime_type] => image/png
        [type] => image
        [icon] =>
        [width] => 0
        [height] => 0
        [sizes] => Array
                [thumbnail] =>
                [thumbnail-width] => 1
                [thumbnail-height] => 1
                [medium] =>
                [medium-width] => 1
                [medium-height] => 1
                [medium_large] =>
                [medium_large-width] => 1
                [medium_large-height] => 1
                [large] =>
                [large-width] => 1
                [large-height] => 1
                [thumb-small] =>
                [thumb-small-width] => 1
                [thumb-small-height] => 1
                [thumb-med] =>
                [thumb-med-width] => 1
                [thumb-med-height] => 1
                [thumb-large] =>
                [thumb-large-width] => 1
                [thumb-large-height] => 1

    Has anyone ever seen anything like this? Any solutions recommended?


  • HI @pixelsmith

    I ran into the issue before (more than once)… where WP was creating 1×1 images for all image sizes. I guess… since they are all the same size, they all have the same URL? (I can’t be sure on that though).

    At any rate… one time… it was a plugin that was creating 1×1 images for all sizes.. like: add_image_size( ‘thumb-1’, 1, 1, true )

    …another time it was image compression software (like WP Smush IT, Shortpixel, Photon) that was messing with image sizes that caused it. I can’t remember the image compression software now (it wasn’t any of the ones listed above tho).

    To fix… I removed the tools… regenerated thumbs, and all was good.

    So… not sure if it’s an ACF issue… it might have happened within the Media Library during upload by some other hook.

    Hope you are able to sort it out, and it’s a simple fix!

  • Hey @keithlock – Thanks for the suggestions.

    I was able to fix the issue by uploading a new image. New images worked just fine, but when I changed images (chose new image, reverted to original image) I ran into the same issue.

    I wish I could solve the issue itself, since there are at least a dozen images I’ll have to change, but at this point I’m glad to have any solution.


  • Hi

    Can you please share any news on this issue?

    Same issue here. While uploading images with Media Library it sets the right links for the custom image sizes in $image['sizes']. But if I upload the image with one of the ACF image fields it sets the actual size image url for all the elements in the $image['sizes'] array.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Image array won\'t output custom image sizes’ is closed to new replies.