skip to Main Content
Our free WordPress themes are downloaded over 5 MILLION times. Get them now!
wordpress thumbnails
Colorlib content is free. When you buy through links on our site, we may earn an affiliate commission. Learn More

Uploaded images are not resizing and generating thumbnails on WordPress using Ubuntu, Debian or CentOS VPS

Today I ran into a problem when I was trying to setup a new WordPress based website hosted on a clean LEMP server using Ubuntu. The thing I noticed was that thumbnails and featured images where not properly resized, well they weren’t resized at all. Correct CSS styles were applied but image size remained uncropped. I did some research on and other WordPress related support forums but could find the answer.

Actually the first thing that came in my mind was that I made some mistakes in my theme pre as this was my own custom theme. I red every topic about




and couldn’t find a single mistake in my pre. And turned out that I didn’t suck at PHP and WordPress functionality but it turned out to be a bigger problem and it has something to do with my server configuration (Ubuntu in my case). Once I realized that it took a moment to realize what is missing – GD module for PHP5.

GD module for php5 is used to handling graphics directly from PHP scripts. It supports the PNG, JPEG, XPM formats as well as Freetype/ttf fonts. If you don’t have this PHP module installed it means that several WordPress features won’t work, such as  image resizer, image cropping, thumbnail and featured image generator and even oEmbed for Twitter, SoundCloud and other content won’t work. I learned this a hard way.

If you are facing the same issues with your WordPress installation you are in the right place because I will show you have to fix this. This will work only if you are running your own VPS/Dedicated server running Ubuntu and won’t help if you are on shared hosting account. However, you can ask them to install GD PHP5 module for you but most shared host already has it installed. If you are on shared web hosting it is highly likely that featured images and thumbnails are not generated because of some other reason.

Solution for Ubuntu and Debian:

To install GD PHP5 module on Ubuntu (any version after 12.04) and other Debian based systems you should run the following commands:

sudo apt-get install php5-gd
sudo service nginx restart

In case you are on Apache (LAMP) server then you can restart it like this

sudo service apache2 restart

Solution for CentOS

sudo yum install php-gd
sudo service httpd restart

These simple commands will install GD PHP5 module for your Ubuntu/Debian or CentOS which will enable WordPress functionalities such as thumbnail generator, featured image generator, image editor, oEmbed and probably some more that I didn’t notice.

Let me know if this is not the case in your situation and I will try to help.

Disclosure: This page contains external affiliate links that may result in us receiving a commission if you choose to purchase mentioned product. The opinions on this page are our own and we don't receive additional bonus for positive reviews.


Frontend web developer and web designer specialized in WordPress theme development. After graduating with BBA he self-though frontend web development. Currently, has over 10 years of experience in mainly CSS, HTML (TailwindCSS, Bootstrap), JavaScript(React, Vue, Angular) and PHP. Obsessed with application performance, user experience and simplicity.

This Post Has 10,676 Comments

  1. Already did the same but still images are not showing

  2. Fernando Balderrama says:

    You’re a lifesaver! I was about to go nuts debugging! I migrated servers from Apache to Nginx in Debian, and I couldn’t find any errors. As soon as I saw “GD” in your post it seemed so obvious!

    Tested and working solution!

  3. Fernando,

    I had a hard time figuring it out myself and then it hit me 🙂

    I was 100% sure that I installed it at first as this server was live for few months but didn’t notice that some functionality is missing. Sometimes the questions are complicated and the answers are simple.

  4. Thank very much ! I’ve got this problem…

  5. diogoarolo says:

    Thank you! It was driving me mad that I couldn’t crop the pictures!
    Thanks a lot!

  6. Joe Villalobos says:

    Thanks It works perfectly!

  7. Wayne Dunkley says:

    Thank you for this. This was driving me crazy!! No errors, no problems, just not working. This was a real pain of an issue but all is now solved

  8. John Miller says:

    I have already installed a new theme in WordPress for a personal project and WordPress couldn’t crop images when I uploaded them to a post. I had spent many hours to find the solution and your post solve it. Thank you Aigars!!! 😉

  9. Thanks, your tip really helps!

  10. Crazy Presser says:

    I still can’t get it to work 🙁 php info shows gd as enabled and working in core output but the thumbnails are not being generated. I am running wordpress 4.6 on centos 7 with php5.4 in aws instance. Tried changing themes, disabling plugins etc but nothing works

  11. Thank you! It was driving me mad that I couldn’t crop the pictures!
    Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top

If you wish to withdraw your consent and stop hearing from us, simply click the unsubscribe link at the bottom of every email we send or contact us at [email protected] We value and respect your personal data and privacy. To view our privacy policy, please visit our website. By submitting this form, you agree that we may process your information in accordance with these terms.