Save images from Url
Using Curl you can easily get a picture from an url. This technique isn't used very often but when you combine it with the new socialgraph API from facebook you can very easily create interactive facebook based applications. (example: a personalized holiday card with a facebook picture from your friends)
You can get any facebook profile picture with a simple url call. So you can grab the profile picture from the url, save it on your server and attach it to a mail,video, flash,... . And you've got your personlized holidaycard.
First we grab the facebook profile picture. Replace 560940 with the facebook profile Id of your choice.
https://graph.facebook.com/560940/picture
Now that we've got the picture we can save it locally with Curl. We can use the following code to loop trough an array $img containing the picture_id and the picture_url. The other parameter $fullpath is the path where you want to save the image. We loop the array with foreach, create a filename based on the picture_id and write the file
function save_picture($img,$fullpath){
foreach($img as $key=>$value ){
/* Generate a filename */
$filename = $fullpath ."/".$key.'.jpg';
/* Save picture in map with Curl */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$value);
$fp = fopen($filename, 'w');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec ($ch);
curl_close ($ch);
fclose($fp);
}
}
We now have all our facebook pictures saved on our server and can use them in various applications.
Note from facebook private policy:
"Information set to everyone is publicly available information, just like your name, profile picture, and connections. Such information may, for example, be accessed by everyone on the Internet (including people not logged into Facebook), be indexed by third party search engines, and be imported, exported, distributed, and redistributed by us and others without privacy limitations. Such information may also be associated with you, including your name and profile picture, even outside of Facebook, such as on public search engines and when you visit other sites on the internet. The default privacy setting for certain types of information you post on Facebook is set to everyone. You can review and change the default settings in your privacy settings. If you delete everyone content that you posted on Facebook, we will remove it from your Facebook profile, but have no control over its use outside of Facebook."
Gert


Comments
Quite detailed and wonderful
Fri, 01/07/2011 - 08:42.
Quite detailed and wonderful post, I would like to share it with my friends, thanks for sharing such a nice and wonderful post.
Sami Parker
Many thanks :)
Wed, 11/16/2011 - 19:37.
This is just a great article !*
Thanks a lot for sharing such a nice and amazing post, its quite informative and in critical terms I would say that it posess all the negative and postitive points of the topic. Thanks again for such a lovely post.
PS : I love the design of your website !
Photo produit e-commerce
note that i read your blog every single day of my life !
:)
Photo e-commerce
Thank you for this great post
Sun, 01/01/2012 - 21:58.
Thank you for this great post! quit smoking
Johny
Nice And Informative Article
Tue, 01/03/2012 - 13:45.
Nice information i got it from your blog post that how we can get an url of pic through curl.Online Term Paper Help Service
williamfitzstephen
I used to save the url of the
Sat, 01/07/2012 - 08:23.
I used to save the url of the image that I like in a file. Sometimes I also sent it to my friends for just sharing. In store this link I used to do it manually or occasionally with this application. engineering services
Didos
I had a lot of trouble with
Sun, 01/08/2012 - 15:07.
I had a lot of trouble with this for quite some time when building my grout stain site. I eventually got it but it really kept me up nights until I did. I wish there was someplace nearby where I could take a course to better learn php because learning on my own hasn't been working out for me. grout stain
John Grout
Thanks for sharing this with
Tue, 01/10/2012 - 14:03.
Thanks for sharing this with all of us. Of course what a great site and informative posts I will bookmark this site. keep doing your great job and always gain my support. Thank you for sharing this beautiful article
roofers northampton
Bruno49
Finally an issue that I am
Wed, 01/11/2012 - 15:41.
Finally an issue that I am passionate about. I have looked for information of this caliber for the last several hours. Your site is greatly appreciated.
Ankauf Münzen
Anonymous
Good job! I have found many
Thu, 01/12/2012 - 14:12.
Good job! I have found many articles to read but you do a good thing. That is a boy. Thank you so much for sharing the delicious post. Expect your next article.
Luton airport taxis
David Green
If most people wrote about
Fri, 01/13/2012 - 17:31.
If most people wrote about this subject with the eloquence that you just did I'm sure people would do much more than just read they act. Great stuff here. Please keep it up.
bleeder cleaner
ElliWaters26
I thoroughly enjoyed reading
Sun, 01/22/2012 - 21:26.
I thoroughly enjoyed reading your article. I really appreciate your wonderful knowledge and the time you put into educating the rest of us.
cheap wedding photography
ShaunParker
Megadevice
Mon, 01/23/2012 - 04:03.
This is a really fantastic article and its commentary in one hundred percent support the leading idea of the author. BR. gry komputerowe
Megadevice
Nice Blog!
Mon, 02/13/2012 - 14:29.
This site is really amazing. social bookmarking
Akanksha
nice one..
Tue, 02/14/2012 - 08:22.
nice one.
multi car insurance
ankur
This technique isn't used
Wed, 02/15/2012 - 09:20.
This technique isn't used very often but when you combine it with the new socialgraph API from facebook you can very easily create interactive facebook based applications. bumper stickers
Anonymous
Reply:
Wed, 02/15/2012 - 13:04.
Such interesting post have a lots of information and news.
Great place for gaming it was. Tere Naal Love Ho Gaya Mp3 Songs || Blood Money Songs download || Kahaani Songs || Agent Vinod Mp3 Songs
Shivammi
I found the perfect place for
Wed, 02/15/2012 - 17:25.
I found the perfect place for my needs. Contains wonderful and useful messages. I have read most of them and has a lot of them.
cheap hosting
Anonymous
The other parameter $fullpath
Sun, 02/19/2012 - 11:40.
The other parameter $fullpath is the path where you want to save the image. We loop the array with foreach, create a filename based on the picture Winnipeg escorts
Anonymous
First we grab the facebook
Tue, 02/21/2012 - 11:42.
First we grab the facebook profile picture. Replace 560940 with the facebook profile Id of your choice. London Escorts
Anonymous
The other parameter $fullpath
Tue, 02/21/2012 - 12:39.
The other parameter $fullpath is the path where you want to save the image. We loop the array with foreach, create a filename based SR22 insurance Florida
Anonymous
Hey your site is really great
Tue, 02/21/2012 - 13:25.
Hey your site is really great I came across while in search for brand info on bing and it has lots of related information on it. Will be sure to come back again and bookmark. Keep up the great work!
Childrens learning toys
JoeBan78
Hello webmaster good day.
Tue, 02/21/2012 - 15:39.
Hello webmaster good day. Superb post. You have gained a new fan. Please keep up the good work and I look forward to more of your great posts.
Food Lovers Fat Loss
Bruno49
The post is absolutely
Wed, 02/22/2012 - 01:25.
The post is absolutely fantastic! Lots of great information and inspiration both of which we all need! Also like to admire the time and effort you put into your blog and detailed information you offer! I will bookmark your blog!
Reading glasses
Bruno49
Good One...
Wed, 02/22/2012 - 12:31.
nice one..Sarkari Naukri
kunal
$img containing the picture
Sat, 02/18/2012 - 11:55.
$img containing the picture_id and the picture_url. The other parameter $fullpath is the path where you want to save the image. We loop the array with foreach, create a filename based on the picture_id and write the file Fatburner
Anonymous
This technique isn't used
Sun, 02/19/2012 - 11:46.
This technique isn't used very often but when you combine it with the new socialgraph API from facebook you can very easily Calendula Cream
Anonymous
The default privacy setting
Tue, 02/21/2012 - 13:54.
The default privacy setting for certain types of information you post on Facebook is set to everyone. You can review and change the default settings in your privacy settings. If you delete everyone content that you posted on Facebook, we will remove it from your Facebook profile, but have no control over its use outside of Facebook. Harry Palmer
jhonywalker
It is very rare these days to
Tue, 02/21/2012 - 15:50.
It is very rare these days to find blogs that provide information someone is looking for. I am glad to see that your blog share valued information that can help to many readers. Thanks and keep writing!
onsite spraying
TimFrancis
The other parameter $fullpath
Wed, 02/22/2012 - 11:37.
The other parameter $fullpath is the path where you want to save the image. best dog training books
Anonymous
Thanks, I've been hunting for
Wed, 02/22/2012 - 15:15.
Thanks, I've been hunting for facts about this subject matter for ages and yours is the best I have found so far.Senuke
Anonymous
So you can grab the profile
Tue, 02/21/2012 - 06:24.
So you can grab the profile picture from the url, save it on your server and attach it to a mail,video, flash,... . gallstone symptoms
Anonymous
I've tried what you say. I
Wed, 02/22/2012 - 12:54.
I've tried what you say. I try to keep photos from facebook and friendster. This method is easy and does not waste a lot of my time. play bingo
BonarBine
The other parameter $fullpath
Thu, 02/16/2012 - 12:37.
The other parameter $fullpath is the path where you want to save the image. We loop the array with foreach, create a filename based on the picture_id and write the file snowboard length
Anonymous
Nice one there is actually
Fri, 02/17/2012 - 16:06.
Nice one there is actually some great points on this post some of my associates will find this worthwhile will send them a link thanks
Property Management Los Angeles
Anonymous
I love anime store pictures,
Sun, 02/19/2012 - 14:58.
I love anime store pictures, sometimes I am overwhelmed to save the image as it is very much. For simplicity I just store the image url address. cheap car insurance
JerukOren
The other parameter $fullpath
Tue, 02/14/2012 - 11:04.
The other parameter $fullpath is the path where you want to save the image. We loop the array with foreach, create a filename based on the picture_id and write the file escort
Anonymous
This technique isn't used
Wed, 02/15/2012 - 12:27.
This technique isn't used very often but when you combine it with the new socialgraph API from facebook you can very easily create interactive facebook based applications. (example: a personalized holiday card with a facebook picture from your friends) Daihatsu parts
Anonymous
First we grab the facebook
Thu, 02/16/2012 - 12:30.
First we grab the facebook profile picture. Replace 560940 with the facebook profile Id of your choice. cheap louis vuitton handbags
Anonymous
Thanks for making such a
Thu, 02/16/2012 - 16:10.
Thanks for making such a killer blog. I arrive on here all the time and am floored with the fresh information here! You are great!
Buy Web Hosting
Anonymous
Yes I've tried to save an
Mon, 02/20/2012 - 07:38.
Yes I've tried to save an image from url. The way that you tell here is practical and easy, I can do it without any difficulty. Adt Home Security System
MartonLisa
It seems this way is easier
Fri, 02/17/2012 - 15:40.
It seems this way is easier and more practical to store images from the internet. I've tried and the results a few seconds faster than the image of storage that I normally do. cheap DVD players
KolanMero
This technique isn't used
Tue, 02/14/2012 - 14:01.
This technique isn't used very often but when you combine it with the new socialgraph API from facebook you can very easily create interactive very cheap car insurance
Anonymous
This technique isn't used
Wed, 02/15/2012 - 09:12.
This technique isn't used very often but when you combine it with the new socialgraph API from facebook you can very easily create interactive facebook based applications. bumper stickers
Anonymous
The live reading was equally
Mon, 01/23/2012 - 11:14.
The live reading was equally exciting, as the cast was really good. Just some of the best improv, stand-up, and theater actors in town. talalay latex mattress
Anonymous
Thanks for posting such a
Wed, 01/25/2012 - 16:56.
Thanks for posting such a nice article. I love the way you have described the whole article. Thanks and keep posting new things
álláshirdetés
Anonymous
Great information
Fri, 01/27/2012 - 03:02.
This was really a great and helpful article to read. I have enjoyed this great and fun information so much. This was really very interesting to me. Data Recovery Services
Calley Arena
First we grab the facebook
Sun, 02/12/2012 - 08:26.
First we grab the facebook profile picture. Replace 560940 with the facebook profile Id of your choice. Cupones Descuento
Anonymous
you delete everyone content
Sun, 02/12/2012 - 13:05.
you delete everyone content that you posted on Facebook, we will remove it from your Facebook profile, but have no control over its use outside of Facebook. Preemie Clothes
Anonymous
I have been assigned to do a
Tue, 02/14/2012 - 01:01.
I have been assigned to do a report for our school newspaper on this subject, and your post has been beneficial. Can you please add more reference to this topic, thanks. Green Anna
Anonymous
Domy ustka
Thu, 02/16/2012 - 01:06.
Jeżeli planujesz wakacje nad polskim Bałtykiem weź pod uwagę domy Ustka a na pewnobnie pożałujesz. Najtańsze nieruchomości na sprzedaż lub wynajem.
Domy ustka
Pages
Add new comment