Hi all.

We are having issues with the media field on node add/edit pages. After you upload the image and do all the step in Media browser modal, uploaded image is not rendered on the node edit page (thumbnail).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkrizaj created an issue. See original summary.

mkrizaj’s picture

Title: Thumbnail image not rendered on add/edit page after you uploade image » Thumbnail image not rendered on add/edit page after you upload image
mkrizaj’s picture

mkrizaj’s picture

Status: Active » Needs review

  • joseph.olstad committed b40ad1a on 7.x-4.x authored by mkrizaj
    Issue #3067177 by mkrizaj: Thumbnail image not rendered on add/edit page...

  • joseph.olstad committed c4ced45 on 7.x-3.x authored by mkrizaj
    Issue #3067177 by mkrizaj: Thumbnail image not rendered on add/edit page...

  • joseph.olstad committed 89da60a on 7.x-2.x authored by mkrizaj
    Issue #3067177 by mkrizaj: Thumbnail image not rendered on add/edit page...
joseph.olstad’s picture

Status: Needs review » Fixed

Thanks!

SHEvents’s picture

I don't know if this is the right place to raise this, and my apologies if I'm wrong, but when I enter a new YouTube video URL the thumbnail image is not rendered on the add/edit page. However, if I then 'save' the page, the video is uploaded and, when I return to 'edit', the thumbnail is shown rendered.

However, if I try to enter more than the one URL before saving the page, only the last URL entered is uploaded.

This means I am having to repeat the 'edit' then 'save' procedure on four separate occasions in order to enter four YouTube URLs.

All modules on my Drupal 7 site are up to date and it's running under PHP 7.1.

Very many thanks.

ps. I'm also having the same problem with photographs.

vdsh’s picture

I just updated to 7.x.22 - which includes this patch - and my thumbnails are now NOT rendering in the node add/edit page whereas it is working as expected if I revert this patch change.

So I guess there is something wrong or missing here to cover all cases

joseph.olstad’s picture

Status: Fixed » Needs work

Ok I will revert this patch and cut a new release shortly... wtf

joseph.olstad’s picture

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

I've tested the latest release on a couple sites already and media embedding worked with both wysiwyg module OR the media_ckeditor / ckeditor modules.

I'll run a few more tests though but I also looked at this javascript code in question above and it should not affect the rendering of the tokens at all.

However there may be something less obvious going on. It would be more helpful however if the above people reporting results could provide greater detail about the before and after such as which modules were updated and which versions used, which web browsers, which version of php, steps to reproduce, even if summarized (however please some detail if possible).

joseph.olstad’s picture

any helpful messages in the watchdog or apache error logs? What version of php ? before and after steps.

SHEvents’s picture

Hi Joseph,

I updated to Media 7.x-2.22. I'm using Media: oEmbed 7.x-2.7.

My web browser is Safari 12.1.1 on a 21.5-inch mid-2011 iMac O/S 10.13.6. I'm running Drupal 7.67. PHP 7.1.30. My module and theme update status is "up to date".

For about three hours, immediately prior to updating to Media 7.x-2.22, I received an error message when trying to upload any YouTube video telling me that the video I was trying to upload was not a YouTube video, when they were, while the thumbnails were still working properly when I was uploading photographs. Immediately after updating to Media 7.x-2.22 I added the mime type 'video/youtube' and I could then enter YouTube videos, however thumbnails ceased to render.

If there is any further information I can provide or if you would like me to try changing any of my settings please let me know.

Richard

joseph.olstad’s picture

Hello @SHEevents (Richard),

Can you please try (apply) this patch and see if this fixes it? Here is instructions on how to apply a patch.

SHEvents’s picture

Joseph,

I have applied the patch: ie by substituting "attachButton.trigger('mousedown');" for "attachButton.trigger('click');". However, there was no "-" against "attachButton.trigger('click');" on the patch you provided, so did you want me to keep 'click' as well as 'mousedown'? Apologies if you did.

However with just 'mousedown' the problem remains. Sorry.

SHEvents’s picture

Hi Joseph,

On the off chance you did want me to add "attachButton.trigger('mousedown');" and retain "attachButton.trigger('click');" I've now tried that but I'm afraid the problem remains.

Richard

joseph.olstad’s picture

Hi @SHEevents (Richard) ,
Seeing as you have confirmed that this commit is not the source of the problem, may I suggest the easiest way to check where the breakage is happening?

Here is what you do:
git clone the media module 7.x-2.x branch like this:
remove the downloaded media module
and replace it with:
git clone https://git.drupalcode.org/project/media.git
and git checkout backwards each commit until October 24th 2018, testing each time clearing all caches , if you tell me exactly which commit causes the break, I can look at that commit and we can look at a solution.

it will be quick because there's not many commits.

SHEvents’s picture

Thanks Joseph,

I'm afraid my Drupal expertise is far from great and I have no idea how to git clone the media module 7.x-2.x branch but I'll try to find out how to do so and let you know what happens. Apologies for putting you to all this trouble.

Richard

joseph.olstad’s picture

Hi @SHEevents please send me a private message here https://www.drupal.org/u/josepholstad and I can assist you directly as I'd like to solve this issue immediately, my reputation is on the line.

errand’s picture

Hello, i have the same problem on my sites
one: PHP 7.0.27-0+deb9u1 + nginx nginx/1.10.3
updated from media 7.x-2.1 to 7.x.2.2
Second: PHP 7.2 + nginx 1.14
updated from media 7.x-2.1 to 7.x.4-beta

Not seeing thumbs but the file is being attached and visible on node view. And when i go to edit mode the thumb is visible.

Edit: downgrading to 7x.2.1 hepls

joseph.olstad’s picture

@errand I suppose you meant to write 7.x-2.21 to 7.x-2.22
not 7.x-2.1

Currently investigating with Richard

otherwise, simply cloning the media module 7.x-2.x branch and moving forward or backward between commits between Oct 24 2018 and July 2019 , moving one commit at a time, testing each commit, will tell exactly which commit is causing this issue.

sorry for the inconvenience, would like to pinpoint this issue.

  • joseph.olstad committed 49c159a on 7.x-4.x
    Revert "Issue #3067177 by mkrizaj: Thumbnail image not rendered on add/...

  • joseph.olstad committed 709127d on 7.x-3.x
    Revert "Issue #3067177 by mkrizaj: Thumbnail image not rendered on add/...

  • joseph.olstad committed ef05391 on 7.x-2.x
    Revert "Issue #3067177 by mkrizaj: Thumbnail image not rendered on add/...
joseph.olstad’s picture

Status: Postponed (maintainer needs more info) » Active

ok for whoever reported this issue, the change caused a regression so I am not accepting this change, so I reverted the changes.

vdsh’s picture

FileSize
25.13 KB
1.57 KB

Hey Joseph,

Thanks for picking up the issue.

Behavior on 7.x-2.21 (no patch) on Chrome on a node/new page after I add an image:
Normal behavior

Same process but with 7.x-2.22, nothing is displayed at all, no error in the console nor in the app logs (only a message indicating that the file has been updated)
Issue

Upgrading to 7.x-2.23 again solves the issue

Note: in all of those versions, I have a console error in the media browser, which I think is linked to client side validation - and not related to that issue. I created https://www.drupal.org/project/clientside_validation/issues/3067552 to follow it

Hope it helps, let me know if you need more info

errand’s picture

@joseph.olstad, you're right, thank you.
I confirm 7.x-2.23 thumbnail is rendering

joseph.olstad’s picture

great yes, 7.x-2.23 release was tagged and pushed, for anyone using 7.x-2.22 , please upgrade to 7.x-2.23

joseph.olstad’s picture

Status: Active » Closed (cannot reproduce)

this issue got messy, if the original report is still important then please open a new issue.

ron_s’s picture

I've not seen this issue with any recent Media release. I would suspect the original problem was due to something else.

For anyone having this problem, a likely possibility would be a JavaScript error that is causing Ajax to break and not render the thumbnail. Make sure to check your Developer Tools console to look for errors and warning messages.