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
Comment #1
minneapolisdan commentedI 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?
Comment #2
minneapolisdan commentedI guess I'm the only person who wants to add a link to their YouTube Preview images...
Comment #3
michellezeedru commentedYou 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.
Comment #4
minneapolisdan commentedThanks 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.
Comment #5
raghugs commentedPlease some one fix the "preview image not being linked with the actual content" problem
Comment #6
tsvenson commentedClosing due to no activity for a long time. Feel free to reopen with updated info if issue still remains.
Comment #7
taiger commentedUsing 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.
Comment #8
sowa commentedI'm facing the same issue.
I'm so surprised too.
Comment #9
maxxer commentedI'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).
Comment #10
Countzero commentedSame 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 ?
Comment #11
manicato commentedsame problem with media 2.x-dev
Comment #12
tomdisher commentedI 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?
Comment #13
icampanaI 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.
Comment #14
Yuri commentedComment #15
devin carlson commentedSee also File Entity Link.
Comment #16
bsarchive commentedThis 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.
Comment #17
devin carlson commentedAs 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.