If you've been working with Drupal long enough, you've had to move your file system location. A few years back the place where you stored all uploaded files, images and other media, as well as where Drupal cached its cache was '/files'. For good reasons this was moved to '/sites/default/files'.

Now, this is all fine and dandy if you don't have a huge image gallery.

Well, let's say you upgrade Drupal AND move the file system location, you will find that the images in your galleries are missing. The Image module does not reset the file system path for each image node. Here's how to fix it.

WARNING: you can completely hose your image store, know what this means before you attempt. Better still, attempt on a backup instance of your site.

In the DB this path is set in two tables: The User Profile 'picture' in the 'users' table and the 'filepath' in the 'files' table.

If you have made the standard move from 'files' to 'sites/default/files' this command will do the trick.

UPDATE users SET picture=REPLACE(picture, 'files', 'sites/default/files');

UPDATE files SET filepath=REPLACE(filepath, 'files', 'sites/default/files');

IF you still do not see all your gallery images, you may have a partial 'migration' of image paths. You may see an image path something like 'sites/default/sites/default/files'. This is due to some images paths being correctly set and some not when you ran the above commands. Here's how to fix your fix:

UPDATE files SET filepath=REPLACE(filepath, 'sites/default/sites/default/files', 'sites/default/files');

That's it.

REMEMBER, KNOW EXACTLY WHAT ALL THIS MEANS BEFORE YOU ATTEMPT. OTHERWISE, CALL A PRO AND PAY THE $$$ TO MAKE SURE ALL GOES WELL.