3

I've got a Video field and the Video Thumbnail is uploaded by the user.

I've got a View which is generating JSON (with the views_datasource extension). I want to include the image url to the Video Thumbnail has one of the fields in my JSON. I've set the formatter on this field to be "Video Thumbnail":

enter image description here

However, the value shown in my JSON output is the url to the original video and not to the Thumbnail image.

So, I tried enabling Rewriting on that field in the Views configuration. I used the [field_video-thumbnail] token to try to get the URL of the Thumbnail image...

enter image description here

but what I get in my JSON is the fid of the Image and not the URL of the image.

  "node" : {
    "title" : "Test 6",
    "body" : "<p>test</p>\n",
    "field_image" : null,
    "path" : "/blog/test-6",
    "created" : "Monday, November, 2012",
    "field_video" : "38"
  }

How can I get the Image Thumbnail URL?

  • dont rewrite output and choose option "link video thumbnail" to url – monymirza Nov 16 '12 at 6:52
  • When I do that it just generates a link to the Video and not the Thumbnail Image. – Kenny Wyland Nov 16 '12 at 23:36
  • what options are in "link video thumbnail" ? – monymirza Nov 18 '12 at 13:27
  • "Nothing" "File" and "Content". I tried them all and didn't get any good results. – Kenny Wyland Nov 18 '12 at 18:15
1

You can use php views, add php field and put this code (change the video field name to yours) in output part

<?php
$file=file_load($data->field_field_video[0]['raw']['thumbnail']);
print file_create_url($file->uri);
?>
2

You are looking for the Image URL Formatter module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.