scottymorg
scottymorg

Reputation: 133

Wordpress Media Library does not display proper thumbnail

I have just migrated the website to new hosting and since then when I tried to upload new media files into the library, it always had HTTP error and media thumbnails are looking like in the attached picture.

enter image description here

I tried to find solution on the internet - removed and added new .htaccess file or added some code in it - none of these work. Has anyone ever faced this problem before? What's the solution?

Thank you, Scott

Upvotes: 1

Views: 998

Answers (2)

summerSun
summerSun

Reputation: 1

adding this as might help someone, an annoying error of my side.

Issue: migrated from localhost to a provider (in a fast maybe hacky way:)

  • exported the entire db from the local mysql (resulting in db.sql)

Changing the file db.sql:

  • changed the url 'localhost' to the domain, in the options-table (manually, typing it, the 2 rows)

  • replaced (as a String search-replace action) all localhost-links, globally (I used VIM :%s/localhost:8080/mydomain.com/g )

  • replaced (as a String search-replace action) the (default) table prefix "wp_" to 'mine': "mf_", globally (also VIM, as above)

Done with the db.sql. Now, uploaded (by filezilla) the files, recreated the db at the hosting provider by 'import' of the db.sql. Did also: set all file and folder permissions as suggested in the web on many places. Did not forget to set stricter permissions for wp-config, and the 644 for .htaccess.

Issue: can access the application, can see (as admin) the media grid. However, all thumbnails were grey, and checking all suggestion as above and in other websites (like the access permissions) it seemed correctly set.

SOLUTION: In the table postmeta (!!!) there are attributes set to images, containing the text-part "wp". By changing the file db.sql globally, all "wp_" (the default prefix for the tables) to 'mine' ("mf_"), these attribute names were also changed.

(what i did then: exported the table postmeta and replace by VIM globally "mf_" again with "wp_", re-imported the table)

Please note: i am not a web developer and i am aware that it might not be the way supposed to be done, but it is the fastest, without much manual clicking around etc.

Maybe it helps someone, it happened a few times to me, so hopefully next time I myself will look into this stackoverflow answer, the idea of re-uploading the images (as suggested in several places) when they are already there is sort of daunting to me.

Upvotes: 0

ron4ex
ron4ex

Reputation: 1083

This is a very annoying problem. In my experience, it causes due to three reasons;

  1. Inappropriate folder permissions for wp-content/uploads folder.
  2. If your site is using HTTPS through CDN like Cloudflare, it needs some additional configuration.
  3. Another reason this might occur sometimes is if you change your theme or as in your case, the host. The solution for this one is to use this plugin Regenerate Thumbnails

You can share some more details for further discussion.

Upvotes: 1

Related Questions