JorgenPhi / php-snapchat

A PHP library for the Snapchat API - With Commit History
MIT License
259 stars 73 forks source link

Specific story's thumbnail #45

Open selimonline opened 10 years ago

selimonline commented 10 years ago

Dear,

The code for specific story's thumbnail ...... $data = $snapchat->getStoryThumb('[story_media_id]', '[story_key]', '[thumbnail_iv]'); For a common story, [story_key] is absent. I have used here media_key instead of story_key. Is this right? But still I am not getting any results for thumbnail. It returns like this 87Áäÿa)ßkä„ÙEËe»eØm"Œ%JÁþó§|gÅëðâaÛdתv„_Ó{óPN»i =‡ýä³X¯PŽ*ä23¾SræS¨}ŒI&;ÅÈÆ\òkf¸ñU¬

What should I do now?

hako commented 10 years ago

Did you try $snapchat->getFriendStories()?

selimonline commented 10 years ago

Ya, I have tried on $snapchat->getFriendStories().

hako commented 10 years ago

That's odd, I managed to get the story thumbnail using that function. it seems that 'garbage' string above might look like the output of the thumbnail.

Try to save the result as a .png using file_put_contents() or am I missing something?

selimonline commented 10 years ago

I am really not clear about your message. Suppose, I have all data of a feed/story(like: id, media_id, thumbnail_iv). How can I get that story's thumbnail?

hako commented 10 years ago

From the function $snapchat->getFriendStories() you will get all the stories on the feed. if you use var_dump() you can see the following:

media_id media_key thumbnail_iv

Put them in$snapchat->getStoryThumb(media_id, media_key, thumbnail_iv) For example, the following code will get the first friend story's thumbnail.

$s = new Snapchat("username","password");

$story =  $s->getFriendStories();

$data = $s->getStoryThumb($story[0]->media_id, $story[0]->media_key, $story[0]->thumbnail_iv);

file_put_contents('thumbnail.png', $data);

I hope this helps.

selimonline commented 10 years ago

Thanks a lot for your support. I am trying and will update you very soon

selimonline commented 10 years ago

As per your previous message. I am using very old version. Can you please send latest API zip file with functions declaration? I will be too much grateful to you.

Thanks in advance Salim

hako commented 10 years ago

Here: https://github.com/JorgenPhi/php-snapchat/archive/master.zip

(The download link is also on the front page of the repo)

selimonline commented 10 years ago

Thanks for response. But I downloaded exactly this files. Here many functions may be old. That's why, I asked for newer one. Like the functions you provided me..... $data = $s->getStoryThumb($story[0]->media_id, $story[0]->media_key, $story[0]->thumbnail_iv); file_put_contents('thumbnail.png', $data);

This is absent there. Any way, I used the above function, have been success to create image. But it's a blank image(fully black). My code is here.

$snapchat = new Snapchat('my_username', 'my_password'); $story = $snapchat->getFriendStories(); $data = $snapchat->getStoryThumb($story[0]->media_id, $story[0]->media_key, $story[0]->thumbnail_iv); file_put_contents('/home/webmaruf/public_html/pst1/snapchat/uploads/thumbnail.png', $data);

I know, I am disturbing you so much. Sorry for that.

Thanks

selimonline commented 10 years ago

Dear, one more help please...... I have media_url and thumbnail_url for friends feeds. May I print thumbnail from this. Then how?\

Thanks in advance Salim