2

I'm using the WP CLI command wp media regenerate to resize all of the images via the /wp-content/uploads directory.

Are the new image dimensions registered in the database in any way or does the resizing just occur in the uploads directory?

I'm asking this because I need to rerun the command and upload the changes to staging. I need to know if I need to perform another database dump.

2

Are the new image dimensions registered in the database in any way or does the resizing just occur in the uploads directory?

No, the image size system is similar to the post type system, sizes are registered at runtime, not in the database. The size of some sizes are stored in the database as they're changeable in the settings area, but this is a singular value in an option, not a per file size.

So WP will store the dimensions of the original image, then defer to these image sizes for the intermediates, it doesn't store the actual dimensions of the intermediates. You could swap out a thumbnail image for a gigantic 20 megapixel JPEG and WordPress wouldn't know.

An easy way to demonstrate this is that if you remove code to register an image size, WordPress no longer knows about that image size or any of the intermediates. If you add a new image size, WordPress will assume files exist for it on existing attachments, even if there are none.

I'm asking this because I need to rerun the command and upload the changes to staging. I need to know if I need to perform another database dump.

No you do not. Unless you change the original image file you're good, the intermediates are just files that can be trashed replaced and rebuilt at will.

1
  • 1
    You rock, thanks, Tom . Another great answer 😎
    – Sam
    Jul 20 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.