Flickr Photoblog allows you to easily create a blog post or webpage from photos on Flickr.
Dan Bough
daniel.bough at gmail.com
http://www.danielbough.com
This software is free to use under the GPLv2 License.
Flickr Photoblog allows you to create a blog post using photos and photo descriptions gathered from Flickr.com. With as little as three arguments, you can create html that can be dropped into any blog post or, if you prefer, you can create a full, stand alone web page.
Inspiration for Flickr Photoblog was garnered from http://www.DannyChoo.com; a blog about Japan. I had noticed that the photos and text used in some posts were identical to their Flickr counterparts. I figured Danny didn't create both copies by hand and so I began investigating ways to do the same thing programatically.
Flickr API Key
http://www.flickr.com/services/api/misc.api_keys.html
PEAR::Flickr_API
http://code.iamcal.com/php/flickr/readme.htm
To Install
- If you do not have PEAR, install it using Aptitude:
apt-get install php-pearor visit http://pear.php.net/ for more info. pear install -of http://code.iamcal.com/php/flickr/Flickr_API-Latest.tgz
Create html for a basic blog post.
Create a Flickr_Photoblog object with three arguments; your Flickr API key, a Flickr username, and a list of comma seperated search terms (tags):
<?php
include "Flickr_Photoblog.php";
// Build object with apiKey, userName and tags
$fb = new Flickr_Photoblog("[YOUR FLICKR API KEY]", "Danny Choo", "akihabarashops");
// Get photos
print $fb->getHtml();
Result:
<img src='http://farm8.staticflickr.com/7411/9036665485_fe4a78a209.jpg' alt='Akihabara Shops 8' height='281' width='500' title='Akihabara Shops 8'/>
<p>Akihabara - the worlds largest concentrated area dedicated to anime, games, manga, cosplay, robot, hobby and computing shops. Today we take our regular gander around the otaku haven in this weeks instalment of Akihabara Shops.
Today we take a lookie at places including Yodobashi Camera, Traders, Dospara, Sofmap, Koubu Inari Shrine [講武稲荷神社], Akihabara Crane Lab, K-books, Kotobukiya, Animate and other small stores located in the back streets of Akihabara.
First photo - huge poster for the up n coming eroge title Amairo Islenauts - my team makes the official mobile app that helps you learn Japanese ^o^
View more at <a href="http://www.dannychoo.com/en/post/26961/Akihabara+Shops+8.html" rel="nofollow">www.dannychoo.com/en/post/26961/Akihabara+Shops+8.html</a></p>
Create html for full web page.
<?php
include "Flickr_Photoblog.php";
// Build object with apiKey, userName and tags
$fb = new Flickr_Photoblog("[YOUR FLICKR API KEY]", "Danny Choo", "akihabarashops");
// Add HTML header
$fb->fullHtml = true;
// Feel free to add a title and give it an H size.
$fb->postTitle = array("Akihabara Shops", "H1");
// Get photos
print $fb->getHtml();
Result:
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<meta name='description' content='Akihabara Shops'>
<title>Akihabara Shops</title>
</head>
<body>
<H1>Akihabara Shops</H1>
<img src='http://farm8.staticflickr.com/7411/9036665485_fe4a78a209.jpg' alt='Akihabara Shops 8' height='281' width='500' title='Akihabara Shops 8'/>
<p>Akihabara - the worlds largest concentrated area dedicated to anime, games, manga, cosplay, robot, hobby and computing shops. Today we take our regular gander around the otaku haven in this weeks instalment of Akihabara Shops.
Today we take a lookie at places including Yodobashi Camera, Traders, Dospara, Sofmap, Koubu Inari Shrine [講武稲荷神社], Akihabara Crane Lab, K-books, Kotobukiya, Animate and other small stores located in the back streets of Akihabara.
First photo - huge poster for the up n coming eroge title Amairo Islenauts - my team makes the official mobile app that helps you learn Japanese ^o^
View more at <a href="http://www.dannychoo.com/en/post/26961/Akihabara+Shops+8.html" rel="nofollow">www.dannychoo.com/en/post/26961/Akihabara+Shops+8.html</a></p>
</body>
</html>
- Set maximum photo size. This will attempt to get photos of the specified size. If they don't exist, the next size lower will be attempted (default starts at Medium).
Sizes:
//
Square (75x75)
Large Square (150x150)
Thumbnail (100 on longest side)
Small (240 on longest side)
Small 320 (320 on longest side)
Medium (500 on longest side)
Medium 640 (640 on longest side)
Medium 800 (800 on longest side)
Large (1024 on longest side)
Large 1600 (1600 on longest side)
Large 2048 (2048 on longest side)
Original (Original size)
//
$fb->maxSize = "Large";
- Add attribution at the bottom of a post:
$fb->attribution = true;. - Add CSS file to HTML header (requires
$fb->fullHtml = true;)$fb->htmlCss = "/path/to/css";. - Create your own HTML header (requires tags):
$fb->htmlHeader = foo;. - Add "Intro" our "Outro" paragraphs:
$fb->postPrefix = foo;&$fb->postSuffix = bar. - Get last error:
print $fb->error;.
- Add
example.phpto your web servers root directory. - Update the
includepath forFlickr_Photoblog.php:include "/path/to/Flickr_Photoblog.php". - Create a world writable directory within your web servers root directory:
mkdir /var/www/tmp,chmod 777 /var/www/tmp. - Browse to
example.phpvia a web browser:http://mywebserver/example.php. - Fill in all fields. The Output Relative Path field shoudl be the folder you created in step 3.
- Maximum photos returned = 100.
- v0.1.0 - Initial Release