I have Media: YouTube videos, being rendered in a grid on my site as image thumbnails. I can also show 2nd field that is the direct link to the video, (e.g. http://youtube.com/watch?v=Pa55qZJy3Io).

What I haven't been able to do is take that LINK and assign it to my Thumbnails. When I try to do this within Views, the output gets screwy.

(e.g. /%0A%0A%20%20%0A%20%20%0A%20%20%0A%20%20%20%20http%3A//youtube.com/watch%3Fv%3DOFyrqPZotxk%20%20%0A%0A%20%20%0A%0A%3Frel%3D0%26width%3D480%26height%3D390%26iframe%3Dtrue?v=OFyrqPZotxk%20%20__%20%20__%3Frel&width=480&height=390&iframe=true)

Any thoughts on why this is, or what to do?

Comments

minneapolisdan’s picture

StatusFileSize
new77.15 KB

I know how to show all the Media associated with a particular node, in Views. But I don't know how to add a link to that media. I can print out the link, but I can't associate that link with anything?

minneapolisdan’s picture

I guess I'm the only person who wants to add a link to their YouTube Preview images...

michellezeedru’s picture

You aren't the only one. I'm pretty close to accomplishing this, but not quite there. Here's what I've done:
- Add the video field to the view, formatter = media, File view mode = link; Rewrite results: check "Strip HTML tags"
and "Remove whitespace"; exclude this field
- Add the video field again, this time formatter=media, File view mode = preview; Rewrite results: check "Output this field as a link" and set the path to: http://youtube.com/watch?v=[field_dta_video_1]

Now I get a link on the preview to http://youtube.com/watch?v= S9WtBRNydso (note the space between v= and the ID). No matter what I do I can't get the space removed, so the link doesn't work.

minneapolisdan’s picture

Thanks michellezeedru, sounds like you are so close. Once I have some time, I'll play around with this some more, see if I can help.

raghugs’s picture

Please some one fix the "preview image not being linked with the actual content" problem

tsvenson’s picture

Status: Active » Closed (fixed)

Closing due to no activity for a long time. Feel free to reopen with updated info if issue still remains.

taiger’s picture

Using Media 2 the preview image cannot be linked with the actual content under Manage Display.

I will have to find a hack or workaround in the meantime. I am surprised that this settings is missing.

sowa’s picture

I'm facing the same issue.
I'm so surprised too.

maxxer’s picture

I'm here also, outputting the link is screwy no matter how much i fiddle withe the rewrite in Views. Michellezeedru's idea works fine, minus the formatting error.

I've taken to hacking this with jquery, which is pretty poor style, but gets the job done in the meantime.
(of course you can always dig into the views field or fields templates, where you can retrieve the image, formatted and then hand wrap it with data from the link field).

Countzero’s picture

Same problem here. All the rewrite stuff in Views doesn't seem to work well at all with Media.

Are there any plans to solve this in a not too far future ?

manicato’s picture

Priority: Normal » Major

same problem with media 2.x-dev

tomdisher’s picture

I thought I could get around by using a full rewrite and doing something like <a href='[path]'>[field_media]</a>

That didn't work either. I have the same use case - have a youtube preview image link to the node instead of playing it from the small thumbnail.

No solutions yet, huh?

icampana’s picture

I had to create a custom field formatter to solve this problem, the field formatter takes care of choosing the correct thumbnail image and render it through a image style, that way it works as a regular field, so that the output can be rewritten normally.

Yuri’s picture

Issue summary: View changes
Status: Closed (fixed) » Active
devin carlson’s picture

Status: Active » Closed (fixed)

See also File Entity Link.

bsarchive’s picture

Status: Closed (fixed) » Active

This isn't fixed!
It's a major problem in Media in my opinion. Effectively you can't get rendered media to link to if you use them in views.

devin carlson’s picture

Priority: Major » Normal
Status: Active » Closed (works as designed)

As mentioned in #13, you need to alter the existing formatter(s)/write your own formatter(s).

Each media provider includes its own formatters for rendering files from the service(s) they support. There's no generic way for Media to support wrapping formatter output in a link since it could contain any sort of markup, such as block-level elements, which would be invalid in HTML 4.

If you don't want to write the formatter yourself, you should check out the File Entity Link module and you could always try filing a feature request against whatever media provider module(s) you're using.