Skip Navigation

[Resolved] Custom Image sizes stopped working in blocks (unable to repair)

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 19 replies, has 2 voices.

Last updated by MargeP6083 1 year, 1 month ago.

Assigned support staff: Nigel.

Author
Posts
#1620511

I am trying to: get the custom image size working. It was working before, but stopped. I am using Offloadmedia plugin, but that shows the same as Media Library.

Link to a page where the issue can be seen: hidden link (Content template 178) Here is the behavior of not allowing change: hidden link

All the images at the bottom of the profile should be 200x200px. There were set before and now they are not working. Also

I expected to see: Cropped, square images on profiles

Instead, I got: various aspect ratios from shape of original image.

#1620977

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Marge

I could see the problem when editing the template, with an error message shown in the image size settings.

I momentarily disabled the WP Offload Media plugin and that fixed the issue, so it appears to be a compatibility issue with it.

Did this used to work? Do you know when it stopped working if that's the case.

I'll see if I can set up a test site locally to reproduce the problem in the meantime.

#1621207

Hi Nigel, We started using cloudfront to serve images recently, as you probably see. Before that, it was fine.

Thanks!

#1621297

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Actually, I'm not in a position to create a test site for this, as I need an active account with WP Offload Media as well as somewhere to offload the media, so I'm escalating this to our compatibility team as they are in a position to set up such a test environment.

I'll keep you posted with any progress.

#1621299

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Can I just check, you switched to using cloudfront from another external service (but still using the WP Offload Media plugin), or cloudfront is the first external service you have set it up to use?

#1621411

Just started using both. Offload helps make the connection with cloudfront.

#1624637

Hi...any update? Thanks

#1625191

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

No results yet, I'm afraid. I can see on the internal ticket that the compatibility team have been busy working on the issue, setting up a testing environment, also identifying other plugins that have related issues with WP Offload Media, but no conclusions or solutions yet.

I'm following the ticket, and when there is something to share I'll pass it on.

#1634731

Hi,
Is this still in process? I have updated to most current version and the issue remains.
Thanks

#1637581

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Marge

I'm taking a copy of your site to compare with a test site we have where it is more-or-less working correctly. You cannot use custom sizes when using offload media (and because of how that plugin works that's never going to be possible), but you can use standard sizes without problems. So one solution would be to register a new size with the dimensions required.

But on your site, something appears broken at a deeper level, because the resizing error appears regardless of what is chosen for the image size.

So we need to work out why that is.

Sorry it is taking a while, we are still working on it.

#1641893

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screenshot 2020-05-28 at 16.14.47.png

Hi Marge

It looks like the reason our test server worked okay while yours reports an error is the setting for the Media Offload plugin shown in the screenshot, namely to remove the files from the local server, which comes with a warning that it may break other plugin functionality.

And that's what appears to be happening here.

Are you able to disable that option so that a copy of the file is kept locally?

In which case it should be possible to work with the registered image sizes and adjust using the CSS option if required (though you could register a specific image size, which I can demonstrate if needed).

#1652283

I added a new image size and regenerated thumbs to add the new image size to all the sizes. The block editor is not recognizing the new size. hidden link

This is the same searchable page as referenced earlier.

Thanks!

#1654139

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screenshot 2020-06-08 at 10.04.03.png

I see the setting is still set to remove the images from the local server, with the warning that it will likely break some plugins.

So I wouldn't necessarily expect it to work while you have that setting enabled.

I've tested on my local copy of your site registering a custom image size and regenerating the thumbnails, and then I can make edits to that content template and specify the new size.

I wonder if when registering the new image size you used the `image_size_names_choose` filter to make the custom size available in dropdowns?

(It seems to be a new requirement related to Gutenberg, described here: https://developer.wordpress.org/reference/functions/add_image_size/#for-media-library-images-admin.)

So as well as registering the custom size with add_image_size you need to use the image_size_names_choose filter to make it available in the editors.

#1654243

Yes, this is what I added for the new size.

// Add new image sizes
add_image_size( 'profile-square', 300, 300, true ); 

add_filter( 'image_size_names_choose', 'my_custom_sizes' );
 
function my_custom_sizes( $sizes ) {
    return array_merge( $sizes, array(
        'profile-square' => __( 'Profile Square' ),
    ) );
}
#1655959

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

The problem is that you haven't changed the setting for the plugin.

My understanding speaking to the developers is that Types cannot work with different sized images if they are not stored on the server, but the one developer who should be able to give me a definitive answer is off until next week.

In the meantime while working on another issue I found a bug relating to Types and image sizes that could affect this, I'm not sure, and unfortunately it is the same developer that would be best placed to answer that.

In the meantime, until I hear otherwise, I believe you cannot use the image block with different image size settings when you remove the local copies of the images.

When I'm able to get more details from the developer I'll follow up here.

Thanks for your patience.