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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gmclelland’s picture

Have 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

Dave Reid’s picture

Status: Active » Postponed (maintainer needs more info)
rickdonohoe’s picture

Status: Postponed (maintainer needs more info) » Active

Hi 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.

blazindrop’s picture

I 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):

  $style = image_style_load('square_thumbnail');

  if ($style) {
    $style['name'] = 'media_thumbnail';
    image_style_save($style);
  }

.. 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:

/**
 * Implements hook_image_default_styles().
 */
function media_image_default_styles() {
  $styles = array();
  $styles['media_thumbnail'] = array(
    'label' => 'Media thumbnail (100x100)',
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array('width' => 100, 'height' => 100),
        'weight' => 0,
      ),
    ),
  );
  return $styles;
}

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.

ellen.davis’s picture

Issue summary: View changes

I 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.

mehotkhan’s picture

hi ,
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

Devin Carlson’s picture

Version: 7.x-2.0-alpha1 » 7.x-2.x-dev
Component: Media Browser » Code
Status: Active » Needs review
FileSize
2.33 KB

It 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, à la media_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.

Devin Carlson’s picture

Status: Needs review » Fixed

Retested #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.

  • Devin Carlson committed c3cf99d on 7.x-2.x
    Issue #2120475 by Devin Carlson: Fixed file icon display issues by...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Spanners’s picture

Life-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.

digitaltodd’s picture

adding square thumbnail worked for me too.