All images that are uploaded to a WordPress site from admin (e.g. via Media Library or inside posts and pages) will have the thumbnails generated automatically.
However, there is a case where WordPress stops generating thumbnails after it is moved from live server to localhost. I encountered the problem when I was developing a WordPress blog locally in a fresh installed XAMPP version 8.2.4-0.
The Cause
WordPress does not generate thumbnails in XAMPP because the PHP GD extension is not enabled yet in that XAMPP installation.
PHP GD extension is an extension required to call Graphics Draw (GD) library whose functions are necessary for creating, handling, and manipulating images in PHP scripts. Prior to PHP version 8.0.0, the extension file was named php_gd2.dll
. In the newer PHP versions, the DLL was named php_gd.dll
.
How to Install PHP GD Extension in XAMPP
Fresh install of XAMPP usually has this extension commented, so all you need to do is to uncomment it. Here are steps to enable PHP GD extension in XAMPP:
- Open php.ini file in C:\xampp\php.
- Search for
;extension=gd
. - Remove the semicolon, so it will become
extension=gd
. - Save the change.
- Restart XAMPP.
Now your WordPress sites can generate thumbnails in XAMPP whenever you upload images from Media Library or inside posts and pages.
Please leave a comment if you encounter any problems.