studio icon indicating copy to clipboard operation
studio copied to clipboard

Remove attachment metadata to fix missing thumbnails

Open sejas opened this issue 1 year ago • 1 comments

  • Related to https://github.com/Automattic/dotcom-forge/issues/8758

Proposed Changes

  • Remove post_meta _wp_attachment_metadata to remove intermediate images information and match existing image files. This is a temporal solution. The ideal solution would be updating php-wasm/node to at least 0.7.20 and using the PHP image editor. If the thumbnails are not fixed out of the box, then we could run wp media regenerate --yes.

Testing Instructions

  • Run STUDIO_IMPORT_EXPORT=true npm start
  • Click on Add site, and select this backup
  • Click on Add site to start creating the site with the import
  • Open the URL /wp-admin/upload.php in your browser
  • Observe all the images except one display the thumbnail. There is one that the original file is missing for some reason in the backup zip.

https://github.com/user-attachments/assets/9d9b5680-9694-433b-a9b7-1425343198ca

Pre-merge Checklist

  • [ ] Have you checked for TypeScript, React or other console errors?

sejas avatar Aug 16 '24 21:08 sejas

@sejas what is the source of the issue here? What is the content of _wp_attachment_metadata for such a broken thumbnail?

wojtekn avatar Aug 21 '24 08:08 wojtekn

Closing this PR, I'll create a new PR that calls wp media regenerate --yes in the import process.

sejas avatar Sep 10 '24 15:09 sejas