Browsing existing media seems to be broken. I get an "Error getting media" when I click on the library tab.

CommentFileSizeAuthor
#21 Untitled.png209.7 KBopetstudio

Comments

aaron’s picture

May have been related to #775864: Rename table {file} to {file_managed}. Could you confirm this is still a problem after updating to HEAD?

Thanks!

aaron’s picture

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

This issue does not seem to be related to #775864: Rename table {file} to {file_managed}. We're running D7-ALPHA4 and media HEAD, and this error continues to display when viewing the Library tab. Firebug produces this error information:


Fatal error: Cannot access empty property in ...site/www/modules/field/field.attach.inc on line 668

Call Stack:
    0.0003     109640   1. {main}() ...site/www/index.php:0
    0.1813   27813984   2. menu_execute_active_handler(???, ???) ...site/www/index.php:22
    0.1822   27926416   3. call_user_func_array(string(18), array(0)) ...site/www/includes/menu.inc:469
    0.1822   27926648   4. media_browser_list() ...site/www/includes/menu.inc:0
    0.1833   28211656   5. MediaEntityController->load(null, array(0), string(1), string(2)) ...site/www/sites/all/modules/media/media.browser.inc:111
    0.1833   28212264   6. EntityAPIController->load(null, array(1)) ...site/www/sites/all/modules/media/media.types.inc:381
    0.1933   30435088   7. DrupalDefaultEntityController->attachLoad(array(15), bool) ...site/www/sites/all/modules/entity/entity/entity.controller.inc:192
    0.1933   30435984   8. field_attach_load(string(5), array(15), ???, ???) ...site/www/includes/entity.inc:241
aaron’s picture

Status: Postponed (maintainer needs more info) » Needs work

confirmed. looking at it right now. stoopid moving target...

aaron’s picture

Priority: Normal » Critical

marking as critical -- it's an alpha4 blocker.

JacobSingh’s picture

I'm not seeing this personally nor on Drupalgardens.com

aaron’s picture

Issue tags: +alpha blocker

i get this in both alpha-4 and head:

- install drupal 7 alpha4 or head
- install media head, entity DRUPAL-7--1 (or drupal-7-1-0-alpha4), styles DRUPAL-7--1
- go to /admin/content/media/add/from_url
- add an image from somewhere on the internet
- gaze in amazement at the wsod

aaron’s picture

i've tracked it down to:

function entity_extract_ids($entity_type, $entity) {
  $info = entity_get_info($entity_type);
  // Objects being created might not have id/vid yet.
  $id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL;
  $vid = ($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL;
  // If no bundle key provided, then we assume a single bundle, named after the
  // entity type.
  $bundle = $info['entity keys']['bundle'] ? $entity->{$info['entity keys']['bundle']} : $entity_type;
  return array($id, $vid, $bundle);
}

$info['entity keys']['bundle'] is 'type', but there's no $entity->type.

aaron’s picture

Status: Needs work » Fixed

so apparently http://api.drupal.org/api/function/hook_file_insert/7 is incorrect; hook_file_insert & hook_file_update must not be a referenced variable. fixed now!

aaron’s picture

Status: Fixed » Closed (fixed)

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

robeano’s picture

Tested successfully with HEAD versions of D7, media and DRUPAL-7--1 version of styles. I used a mediaasset field for testing but did not test with wysiwyg.

The browser is really coming along. Great job aaron!

cakka’s picture

Version: » 7.x-1.x-dev

i am using wysiwyg, and get this problem...

KevinC’s picture

Priority: Critical » Major
Status: Closed (fixed) » Active

This issue has raised its ugly head again. Using either Full or Filtered WYSIWYG. Thought it might be number of files as client has 697 media files.

elpino’s picture

It's not the number of files, I'm having this problem with less than 10 images.

I am using latest WYSIWYG module with CKEditor and Media 7.x-1.0

mpgeek’s picture

Assigned: Unassigned » mpgeek
Status: Active » Postponed (maintainer needs more info)

Issue is marked for 7.x-1.x-dev. Have we tried the latest media-7.x-1.x-dev to see if we have a fix? If not can we get steps to reproduce (perhaps a screenshot)? Not seeing any error with getting media on latest version of this branch.

mpgeek’s picture

Assigned: mpgeek » Unassigned
Status: Postponed (maintainer needs more info) » Closed (works as designed)
techpassion’s picture

Having same issue.
This is what I remember:
I was trying to upload an image and it errored out with a out of memory error.
"Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 13056 bytes)"

And ever since then, I cannot browser the library.
I don't know if this helps in any way.

techpassion’s picture

Just an update to the above. The file that I was trying to upload was actually present in the folder. Every time I tried to upload it, I got an out of memory error, but the file was getting uploaded.
When I deleted all the copies of that image(physical files) I was able to browse the media library again. But I could still see the entries of the deleted files.

_grizly’s picture

/**
 * Returns a renderable array with the necessary classes to support a media
 * thumbnail.  Also provides default fallback images if no image is available.
 *
 * @param $file
 *
 * @return array
 *   Renderable array.
 */
function media_get_thumbnail_preview($file, $link = NULL) {
  // If a file has an invalid type, allow file_view_file() to work.
  //if (!file_info_file_types($file->type)) {// Hack, assume all files are bad
    $file->type = media_get_type($file);
  //}

Works for me. (Currently around line 1063 of media module, sites/all/modules/media/media.module)

opetstudio’s picture

Version: 7.x-1.x-dev » 7.x-1.2
StatusFileSize
new209.7 KB

emergency. please help me. I get the same error for the version 7.x-1.2
when I click on the library tab, javascript alert appears that says "Error getting media.".......pleaseeeeee heeelllllppppp meeeee...!!!!!!!!

Marcus Aurelius’s picture

Same here. Version 7.x-1.2
Please help...

maen’s picture

exact the same for me with drupal 7.19!

ictguy@gmail.com’s picture

Subscribing ... I have the exact same issue. Drupal 7.19 and Media 7.x-1.2.

As soon as I choose library I get the error as per the image in comment #21

ccannon’s picture

Status: Closed (works as designed) » Active
ccannon’s picture

Status: Active » Closed (works as designed)

oops, sorry for changing status.

I was having same issue as commented in #21.
I was able to successfully implement the hack in #20 (thanks _grizly) and it is now working. So I can confirm that altering the media.module file as shown in comment #20 resolves the issue with wysiwig editors (at least ckeditor version 3.6) not being able to get media from library.

drupal 7.18
media 7.x-1.3

internet mate’s picture

Solution from #20 works - thanks!
I had same issue on Drupal 7.20, Media 7.x-1.3 but only on dev (Ubuntu) server.
It was fine on my local virtual (Ubuntu) machine, though - same files and database on both.

marqpdx’s picture

Solution from #20 works - thanks! much appreciated.

Drupal core 7.21 and Media 7.x.13.

the change is now around line 1084, and i left the following code intact. Mine now looks like:


function media_get_thumbnail_preview($file, $link = NULL) {
  // If a file has an invalid type, allow file_view_file() to work.
  //if (!file_info_file_types($file->type)) { //HACK from http://drupal.org/node/747998#comment-6980294
    $file->type = media_get_type($file);
  //} //HACK

  $preview = file_view_file($file, 'media_preview');
  $preview['#show_names'] = TRUE;
  $preview['#add_link'] = $link;
  $preview['#theme_wrappers'][] = 'media_thumbnail';
  return $preview;
}

noslokire’s picture

#20 worked for me as well

sierra_73’s picture

Version: 7.x-1.2 » 7.x-1.3

#20 does not work with me. Help me. I still have " error getting media "
I have Drupal 7.22 and Media 7.x-1.3

Bob123’s picture

Same issue,

Drupal: 7.22
Media: 7.x-1.3
Wysiwyg: 7.x-2.2
TinyMCE: 3.5.8

#20 does not work with me neither!

The problem seems to be related to the file sizes:
I deleted (moved) the 3 biggest files (2 150K; 1 850K, and 1 515K) from /sites/default/files/... and now it works.
This is only a very temporary work around: I Need this files!

- Only image (.jpg) files seems to cause the problem. PDF files can be larger.

Please help finding a more definitive solution.

dublutz’s picture

Component: Code » WYSIWYG integration
Status: Closed (works as designed) » Needs work

I have the same problem.
With the same files on first server is working on second it doesn't.
I think this is related to server configuration.

Check Status report and see if there is an warning about MySQL - max allowed packet configuration.

Drupal Database Requirements can be found here:
https://drupal.org/requirements/database

I didn't test it yet because I don't have access to second server, but I will let you know if I have an answer.

Bob123’s picture

No MySQL warning in Status report.

sierra_73’s picture

Have still problems in the library, indeed it can open, however, after scroll with 30 pictures and appears again mistake " Error getting Media".
I have very big problems . Please help me . I needed this library.

bember’s picture

Same issue here.

The problem on my system is caused by this error:

Fatal error: Call to undefined function file_info_file_types()

Thus, solution #20 makes sense, but it is paliative.

The function file_info_file_types() is implemented in the file_entity module inside media module folder (modules/contrib/media/file_entity). I've noticed that the enabled file_entity module on my Drupal instalation was another one, located at modules/contrib/file_entity, which does not implement file_info_file_types() function. I've solved the problem by following these steps:

  1. removing folder modules/contrib/file_entity
  2. accessing admin/modules
aaron’s picture

Status: Needs work » Postponed (maintainer needs more info)

It sounds as though people may have an issue if they are including the file entity module separately from the module included with the media module for version 7.x-1. Could more people please confirm if this is the case?

Anonymous’s picture

I am having the same issue.

Drupal 7.22
Media 7.x-1.3
File Entity 7.x-1.3

Anonymous’s picture

I fixed my error by running "drush rr" (rebuild registry) command. Yeah!

illuminatico’s picture

I was able to fix this problem by removing the file_entity module from sites/all/modules/.

The file entity module packaged with media module still exists in sites/all/modules/media

Thanks!

pkeyes’s picture

I can confirm I was experiencing this error using separate file_entity module. Disabling and removing it, then re-enabling included file_entity module, solved the issue.

GuyRus’s picture

Getting this error without the file_entity module outside of the media module.

It's weird; was working for just admin until I created another user then broke.. Perms on new user are configured correctly.

Steff Vanhaverbeke’s picture

We experienced the same problem: Error getting media in library
The issue was resolved when we deleted the seperate file_entity module, as described by GuyRus

Bob123’s picture

I got this error but I had never used the external file entity module: I always used the included 7.x-1.3 module.

So the issue seems not to be related to the external file entity module!

dalehgeist’s picture

I disabled and removed the external file entity module, enabled the included one, and this did not solve the issue. Version 7.x-1.4

Gil_Gamesh’s picture

Component: WYSIWYG integration » Code
Issue summary: View changes

I have this with

File entity 7.x-2.0-alpha3
Media 7.x-1.4
Drupal 7.31

Uninstalling and reinstalling media and File entity didn't help

Gil_Gamesh’s picture

My bad.

I had downgraded from Media 7.x-2.0-alpha3 and forgot that 7.x.-1.4 used its own built-in File entity.

When I uninstalled File Entity and deleted it from modules/contrib, it works fine again.

  • aaron committed 8a0b90a on 7.x-3.x
    #747998 by aaron: Fix error getting media in library: hook_file_insert...
joseph.olstad’s picture

Status: Postponed (maintainer needs more info) » Fixed

fixed a while back.

Status: Fixed » Closed (fixed)

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