Images not resizing on upload in WordPress

I stumbled across a problem today which for some reason I’ve not noticed before. When I uploaded an image in wordpress on my local machine it wasn’t resizing the image. Each time it was shown on the webpage, it simple scaled down.

One possibly problem was that the add_image_size function was being called before the add_theme_support one. To rectify this, I added them both in to the one function on init. You could call this on theme setup too.

I had the code added in my functions.php file to resize images:

//-- add images for the custom theme
function wpse_setup_theme() {
    add_theme_support( 'post-thumbnails' );
    add_image_size( 'blog-home-featured', 1024, 768, true );
    add_image_size( 'blog-home-thumbnail', 300, 200, true );
    add_image_size( 'blog-single-featured', 1024, 768, true );
    add_image_size( 'blog-sidebar-thumbnail', 75, 75, true );
}
add_action( 'init', 'wpse_setup_theme' );

It should have worked fine yet each time, none of my custom image sizes were working. I downloaded and tried to use the image regeneration plugin from wordpress… nothing. I also read on another blog that somtimes if the images are too big they will fail to be resized – but the images were all around 8mb which seemed to be OK. Memory also wasn’t an issue.

Solution

I use AMPPS on my local dev machine and it was a simple as enabling the GD library within PHP. Once I restarted Apache, that sorted the problem!

ampps-screenshot-php-settings

Hope this helps someone else as I wasted a good hour on it.

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz