I want to get the large facebook video thumbnail using graph. Below code get the small thumbnail
https://graph.facebook.com/VIDEO_ID/picture
This code will return Ex:
https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632393_10151574602254838_10151574598089838_34404_282_t.jpg
If i replace "t" with "n" i will get the large image
https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632393_10151574602254838_10151574598089838_34404_282_n.jpg
But how do i get it using facebook graph or replace "t" with "n" using php
Thanks in advance.
you can use this php code, its working for me.
<?php
$video_id = "10153231379946729";
$xml = file_get_contents('http://graph.facebook.com/' . $video_id);
$result = json_decode($xml);
$small = $result->format[0]->picture;
$medium = $result->format[1]->picture;
//fetch the 720px sized picture
$large = $result->format[3]->picture;
?>
<img src="<?php echo $medium;?>">
Related
Below code, I got title and description but I want image as well as
how to get the main image of video from JSON data.
$videoid = 'cMC_PtgKDJE';
$apikey = 'xyzxyzxyz'; //My API key
$json = file_get_contents('https://www.googleapis.com/youtube/v3/videos?id='.$videoid.'&key='.$apikey.'&part=snippet');
$ytdata = json_decode($json);
print_r($ytdata);
echo '<h1>Title: ' . $ytdata->items[0]->snippet->title . '</h1>';
echo 'Description: ' . $ytdata->items[0]->snippet->description;
Each YouTube video has 4 generated images.You can create the url as fallows
https://img.youtube.com/vi/<video-id-here>/0.jpg
DEMO
If you want high quality image then you can read following atricle
how to get a youtube video’s thumbnail image in high quality
How to get video id from youtube url
$url = "http://www.youtube.com/watch?v=7zWKm-LZWm4&feature=relate";
parse_str( parse_url( $url, PHP_URL_QUERY ), $url_vars );
echo $url_vars['v'];
// Output: 7zWKm-LZWm4
?>
Each video on YouTube provides several thumbnails of different quality
Default (for small thumbnails):
$ytdata->items[0]->snippet->thumbnails->default->url;
Medium:
$ytdata->items[0]->snippet->thumbnails->medium->url;
High:
$ytdata->items[0]->snippet->thumbnails->high->url;
Standard:
$ytdata->items[0]->snippet->thumbnails->standard->url;
Maximum resolution:
$ytdata->items[0]->snippet->thumbnails->maxres->url;
I want to get thumbnail of facebook videos from a given video ID .
I use the preg_match function to get facebook video ID from a given url retrieved from database
preg_match("~/videos/(?:t\.\d+/)?(\d+)~i", $value->url, $matches);
$video_id = $matches[1];
echo ' <div class="fb-video" data-href="https://www.facebook.com/facebook/videos/'.$video_id.'/"></div>';
I want to posted on website with something like this:
<img src="VIDEO_IMAGE.<?php echo $video_id ?>.jpg">
I don't know if it' posssible? !
Your image source is wrong try using
<img src="https://graph.facebook.com/VIDEO_ID/picture" />
Example : https://graph.facebook.com/10153231379946729/picture
I need convert youtube video to mp3 using Quick MP3 API.
http://www.quick-mp3.com/api/v1/docs/
my code example is :
<?php
$url="http://www.youtube.com/watch?v=qpgTC9MDx1o";
// i need to fetch video informations and get mp3 download link
?>
Thank you.
try this code :
don't forgot to include quick_func.php in your php code
require_once('./quick_func.php'); // quick mp3 functions
$url = "http://www.youtube.com/watch?v=qpgTC9MDx1o";
$exp = explode("?v=",$url);
$vid = $exp[1];
$data = Convert_Vid($vid); // video id to convert
$id = $data['id']; // get video id
$title = $data['ttl']; // get video title
$duration = $data['duration']; // get video duration
$thumb = $data['thumb']; // get video thumb
$mp3 = $data['mp3']; // get mp3 download link
print_r($data);
you need to transform your full youtube url to video ID :
$url = "http://www.youtube.com/watch?v=qpgTC9MDx1o"; // full youtube url
$exp = explode("?v=",$url); // explode url
$vid = $exp[1]; // get id after ?v=
Enjoy ;)
You should try below API to get mp3 format of any YouTube video as quick-mp3 is no more available.
<iframe id="buttonApi" src="https://convert2mp3s.com/api/button/mp3?url=https://www.youtube.com/watch?v=pRpeEdMmmQ0" width="100%" height="100%" allowtransparency="true" scrolling="no" style="border:none"></iframe>
GitHub Project: https://github.com/matthew-asuncion/Fast-YouTube-to-MP3-Converter-API
I am building a custom wordpress theme and have a slideshow on the front page displaying images from blog posts.
Now if the image is over 300px in height I want to force its widthand center it vertically. So my question is:
Is there a way, in php or javascript to get the height of an image by only using the URL of the image?
EDIT: I tried this: <?php list($height) = getimagesize(echo catch_that_image()); echo "<p>$height</p>"; ?> where catch_that_image() returns the URL, but somehow this doesn't work (I think the first echo breaks it). Any ideas?
Thank you for your help.
image by only using the URL of the image?
var img = new Image();
img.onload = function() {
alert('The size is ' + this.width + 'x' + this.height);
};
img.src = 'some image URL';
Try it
http://jsfiddle.net/NPSMN/
ps:
I tried this: ... where
catch_that_image() returns the URL, but somehow this doesn't work (I
think the first echo breaks it). Any ideas?
did you look closer at your code? echo outputs to the browser, not to the argument of the function.
<?php
list(,$height) = getimagesize(catch_that_image());
echo "<p>$height</p>";
?>
See getimagesize() in PHP. That will do what you're looking for.
http://php.net/manual/en/function.getimagesize.php
<?php
$url = "http://www.example.com/image.jpg";
list($width, $height) = getimagesize($url);
echo "Width: $width<br />Height: $height";
?>
I need to get the width and height of a .mov-file with php.
How do I do that?
I have used getid3 in the past to achieve this you can grab it from http://www.getid3.org/ I am not sure how well maintained it is anymore
You could knock up some code to look similar to this
<?php
include_once('getid3.php');
$getID3 = new getID3;
$file = './file.mov';
$file_analysis = $getID3->analyze($file);
echo 'Video Resolution = '.$file_analysis['video']['resolution_x'].' X '.$file_analysis['video']['resolution_y'];
?>