Page 1 of 1

[CDS API] Retreiving resources and cover image

PostPosted: Mon Aug 05, 2013 1:24 pm
by kissskoool
Hi,

First thanks for all the good work and the well documented APIs.

But i still have some little questions :

- When i browse the medias with the CDS API, i get this value for thumbnailUrl : cds/resource/12/COVER_IMAGE,1
Then i try to retreive the cover image giving this complete url to curl : http://localhost:23424/cds/resource/12/ ... xxxxxxxxxx
But it doesn't work. is it right ?

- My other question is with the browse method.
In this url, /cds/browse/{profile_id}/{object_id}/{browse_method}/{filter}/{start_index}/{requested_count}?authToken={token}, what profile_id stands for ?
Where cab i find the different values for this parameter ?

Thanks !

Re: [CDS API] Retreiving resources and cover image

PostPosted: Mon Aug 05, 2013 4:09 pm
by kissskoool
I made a little step forward, and i found that the problem wasn't with the url but with my php/curl code.

Now, i retreive the image binary but i'm trying to display it.

Here is my php code :


  Code:
$url = 'http://localhost:23424/cds/resource/12/COVER_IMAGE,1?authToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxx';

function cds_cover($url) {
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: image/jpeg"));

   $res = curl_exec($ch);
   curl_close($ch);

   return $res;      
}


How to show the cover image from the binary ?

Re: [CDS API] Retreiving resources and cover image

PostPosted: Mon Aug 05, 2013 4:37 pm
by zip
to your original question, profile id is found in application-profiles.xml or profile.xml, try with 'flv_player'
You must also add token at the end of the URL.

Re: [CDS API] Retreiving resources and cover image

PostPosted: Mon Aug 05, 2013 11:25 pm
by kissskoool
Thanks for your answer !

About my original question, i found the solution if someone has the same problem :

  Code:
function cds_cover($url) {
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: image/jpeg"));

   $res = curl_exec($ch);
   curl_close($ch);

   return $res;      
}

$t = $item->thumbnailUrl;
$t = "http://localhost:23424".$t."?authToken=".$token;
$img = cds_cover($t);

$img = base64_encode($img);

<div class="cover_image">
   <img src="data:image/jpeg;base64,'.$img.'">
</div>

Re: [CDS API] Retreiving resources and cover image

PostPosted: Tue Aug 06, 2013 2:07 am
by kissskoool
I'm sorry, but all this topic is my mistake :oops: ;/

The previous solution works but is really heavy.

I must be tired because i was writing html with php, setting image sources to localhost links .... :cry:

Forget all i said, and just be careful to set the right url for your cover images :

<img src="http://yourdomain_or_ip:23424/cds/resource/12/COVER_IMAGE,flv_player?authToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxx" />

Sorry !

+