Rebuilding Thumbnails in Gallery 2

Have you ever wanted to recreate thumbnails and resized picture copies for your photos in Gallery 2?

I did recently after making a settings change to the ImageMagick image processing library and was surprised that it wasn’t a more straightforward process.

Here’s how I did it. In case you’re wondering, I’m using version 2.3.

1) Before you start, note that it can be time consuming to rebuild all of your thumbnails. I recommend that you place Gallery 2 into maintenance mode. To set maintenance mode, login as an administrator and navigate to Site Admin -> Maintenance (, you’ll need to modify this URL based upon your own Gallery 2 installation). Select the Maintenance Mode checkbox there and click Set.

2) Navigate to in your browser. This is the key step that I had a hard time finding;

3) Enter your Gallery 2 password and click Verify Me;

4) Click the Cache Maintenance link;

5) You’ll be presented with a list of checkboxes representing cached items to delete. Unselect everything except for Thumbnails and resizes and then click Clear Cache. This will delete all existing thumbnail and resized picture cache files.


6) Now you’ll need to generate new thumbnails. Login as an administrator and navigate (again) to Site Admin -> Maintenance and click the run now link next to Build all thumbnails/resizes. This part can take a long time during which your browser may timeout. If it does, repeat this step until all of your thumbnails are rebuilt.

7) Exit maintenance mode on your site if you set this option in step 1.

9 thoughts on “Rebuilding Thumbnails in Gallery 2”

  1. Thanks for this info. I just switched from ImageMagick to NetPBM and used this procedure to rebuild the thumbnails and resizes.

  2. I’ve had better luck with going to the g2data/cache and doing a
    nice rm -rf module/ && mkdir module/
    and similar for other directories under cache/

  3. @drew: Thanks for the tip, that’s a route I haven’t tried before. It certaintly seems doable, but doesn’t use the Gallery 2 admin UI and may require a level of Unix shell sophistication that users don’t have.

  4. Hello! I am an intermediate user of various photo software but am faced with a problem that it sounds like you could solve? I have color thumbnails of my daughters wedding that only open in black and white, as the photographer changed them in JPEG prior to giving them to me. Currently, no matter what option I use on every single kind of photo software (for Windows) that I can find, any action at all turns the thumbnail to a black and white version. Is there any way to obtain an unchanged version of the thumbnail?ine

  5. I can’t think you enough. I had some broken thumbnails in my collection of 13,322 photos and my “rebuild thumbnails” would stall out every time at around 650 done out of 13,332. I did your recommended cache clear and then I was able to keep backing up a screen and starting the process over until it completed. The firefox session times out at 4410, 4590, 5515, 5815, and I then received a screen full of error messages. I cleared cache once again, it failed and I cleared it again OK. The process then stalled at 6185, 6660, jumped up to 12,360, then 12,645, and 13,185. The next start of the process finally made it to the end, 13,322 items checked – 15 items built (a shame to have to work this hard just to fix 15 broken ones but that’s the way it goes!). Thanks – couldn’t have done it without this suggestion. It works!

  6. I am curious where Don Anthony is seeing these numbers. I am following the instructions, and have gone back and forth from clearing the cache to rebuilding the thumbnails about a dozen times, and I never see anything that indicates any progress at all.

    I click the “rebuild broken images” link, which says it was last run successfully in 2008, and a few minutes later I get a 500 Internal Server Error. I clear the cache, go back to the maintenance page, and it says the exact same thing: it was last run successfully in 2008. I click the link again, and a few minutes later I get a 500 Internal Server Error.

Comments are closed.