Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have an issue which I think may be related to this - https://drupal.org/node/1388106 - however fixes there don't seem to solve it, and the files don't exist so I assume it maybe slightly different.
When browsing for existing files I get no images shown (see screengrab). Usually the broken file path points to sites/default/files/styles/media_thumbnail/public/imce/IMAGENAME, however the actual image is located under sites/default/files.
Is this a site / permissions problem or a bug?
Comment | File | Size | Author |
---|---|---|---|
#7 | save-legacy-image-style-2120475-7.patch | 2.33 KB | Devin Carlson |
broken-thumbnails.jpg | 35.33 KB | rickdonohoe |
Comments
Comment #1
gmclelland CreditAttribution: gmclelland commentedHave you overridden any of the core image styles? If so, I had a similar issue were I had to revert those image styles and then everything worked.
Hope that helps
Comment #2
Dave ReidComment #3
rickdonohoe CreditAttribution: rickdonohoe commentedHi David,
The issue happened to be the image styles. From what I can tell square_thumbnail was changed to media_thumbnail in the Media 2 upgrade, and hasn't cleaned up the references properly (am I correct there?!)
Anyway, to fix it I cloned the media_thumbnail image style to re-create the square_thumbnail style which was missing.
I've set it as active in the event that I have got that correct there, and a patch needs to be created.
Comment #4
blazindrop CreditAttribution: blazindrop commentedI can confirm #3. I'm confused why the machine name would be changed from square_thumbnail to media_thumbnail, though. Here's what I think is happening:
In the update routine (also in version 7.x-2.0-alpha2):
.. it is renaming the machine name of the square_thumbnail style to be media_thumbnail. The result is an override is automatically created since the media module defines a default image style (used by features/ctools) here:
Reverting this style will quickly destroy any customizations you had to the original "square_thubmail" style.
Without any deep knowledge of media I'm not sure about the best approach is to fix this. I'm searching around to see why it was renamed in the first place since best practice dicates never to change machine names.
Comment #5
ellen.davis CreditAttribution: ellen.davis commentedI came across this issue on one of my sites. I changed the machine name for square thumbnail to square_thumbnail. Then media_thumbnail appeared in the list of styles. When using media browser in ckeditor, it now displays the thumbnails in the Library.
Comment #6
mehotkhan CreditAttribution: mehotkhan commentedhi ,
on my image-styles i have media_thumbnail ,but on media browser don't show image thumbnail ,
i uninstall media module many times , but media browser don't fix ,
for all thumbnail show :
/files/styles/media_thumbnail/public/media-icons/default/image-x-generic.png?itok=gTGcRXZF
latest dev version in install
thanks for your great work
Comment #7
Devin Carlson CreditAttribution: Devin Carlson commentedIt looks like a better approach would be to either conditionally define the square_thumbnail image style in
hook_image_default_styles()
based on a legacy variable, à lamedia_show_deprecated_view_modes
, or to save it in the database and remove it from code.The attached patch takes the second approach, removing the square_thumbnail image style from
hook_image_default_styles()
and changing the update function to save the image style in the database. The square_thumbnail image style may already exist in the database if the user has done any customizations to it, so the update function checks for its existence and leaves the style alone if it already does.Comment #8
Devin Carlson CreditAttribution: Devin Carlson commentedRetested #7 with an old Media install and didn't run into any issues. I've now seen a couple of reports that this has worked for folks who have had issues with missing images after upgrading Media.
Committed to Media 7.x-2.x.
Comment #11
Spanners CreditAttribution: Spanners as a volunteer commentedLife-saver! #3 fixed it for me. Created a new image style, called it Square Thumbnail, ensured the machine name was square_thumbnail, set the image style to scale and crop to 100x100px and saved.
Then, when I created a node with an image field on it, the preview thumbnail generated, and all the image thumbnails in the library were back as well.
Comment #12
digitaltodd CreditAttribution: digitaltodd as a volunteer commentedadding square thumbnail worked for me too.