Monday 13 July 2009

Jacob Gibbins - Photography

Jacob Gibbins is arguably one of the South Wests most up and coming cycling photograher (his style's not just restricted to cycling but it is the main field he excels in). However what Jacob makes up in photography skills he slightly lacked in website design. So I decided to put my skills to use in helping a fellow Photographer/Cyclist out.

Now I'm not saying at all that I have good web design skills or coding skills but I do like to think I'm not terrible at either so here's what I made for Jacob:

His full site can be viewed: http://www.jacobgibbins.co.uk/

As always wherever I've tried where I can to make my work under creative commons act so feel free to nab the HTML and CSS (obviously all images are copyright to Jacob Gibbins so don't nab them!)

I've also uploaded the FLV file so feel free to use this also under creative commons. I tried to comment wherever I felt people might get confused. My plans are to make a proper loader bar between images and to tidy the code up some what. But I am getting married in less than 3 weeks so this website has slipped a tad in priorities!

The idea of this FLV file was to have an easily accessed and mostly protected set of Jacobs top 33 images. Sadly it really only works for landscape images but two portraits side by side also works! I wanted to create a flash file which meant Jacob wouldn't have to constantly edit some flash file to alter his top 33 images. I got around this by getting the flash file to search the folder "MainPhotos" on his server and grab the pre numbered images from there. So simply changing these images is all he needs to do to change his portfolio images. Making sure they have the same names and it should be simple as!

Wednesday 8 July 2009

Googles OS - why I didn't bet!

It's everywhere I feel I should write something about this here... Google have annoucned their making an Operating system to contest with Linux, Windows and OSx: http://news.bbc.co.uk/1/hi/technology/8139711.stm

The reason I'm writing about it is that I want to say what I think their plan will be so when it happens I can refer back to this post and go I predicted this much like me and my brother predicted them eventually making a OS after releasing Chrome, if only we'd laid a bet on it happening!

My predictions, Chrome OS, will be a very slim lined OS think Iphone style, based fully around a online content, with everything being stored online and not on your computers memory with small apps accessing this data as requested. I feel googles aim here is that you could log into anyone's computer running chrome and have your desktop with you, true cloud computing style. Much like it is within any buisness hot desking etc. This will mean google will own everything.. a scary thought but with Googles track record I'm happy for this to happen!

What this will mean for E-Learning... with the lack of need for a resource hungry computer we can have very cheep and small netbooks running Chrome OS perfectly fine. Which will hopefully mean E-learning will be accessible to far many more people (not that there are an abundance of people without computers in the UK). From an Learning Technologists Point of view, I'm going to have to learn how to code for Chromes apps, and will have to create more online resources, (which is what I mostly do now).

Errm that's all I have for now, feel like a pleb for saying all this but just don't want it to emerge later and for me to have been right but with no evidence that I thought all this. I might be totaly off here but still that's my say.

And lastly... It's already made! The Chome browser was just released no hype no nothing because, google sent a publicity person the wrong link, I rekon they've already made Chome OS...

Friday 3 July 2009

Some START progress

Well it seems I've finished the majority of the back end work for this project, successfully integrating Twitter, Picassa and Blogger into one page using, PHP & XML... Which I'm quite happy with seeing as prior to this project I've not coded anything in php! As part of me trying to maintain the whole creative commons thing and trying to share and share alike thingy here's the code I've used:

Blogness.php - Grabs the xml from the rss feed and displays all posts:
Adapted from: http://www.hiash.com/blogger.php

<?php
define('MAGPIE_DIR', '../../magpierss/');
require_once(MAGPIE_DIR.'rss_fetch.inc');

//RSS feed has to be of ATOM format
$rss = fetch_rss( 'http://www.blogger.com/feeds/8911594570691911602/posts/default' );

//display latest blog content:
foreach ($rss->items as $item) {
$title = $item['title'];
$content = $item['atom_content'];
echo "<h1>$title</h1><p>$content</p>";
}
?>


Twitterness.php - grabs the rss from your public twitter feed and displays the last 5 posts...
Adapted from http://workbench.cadenhead.org/twitter-rss-to-html/


<?php

define('MAGPIE_DIR', '../../magpierss/');
require_once(MAGPIE_DIR.'rss_fetch.inc');

$tweets_to_display = 5;
// the page where the tweet(s) will be displayed
$page = "";
// the user's Twitter username
$username = "StartPlymouth";


$rss = fetch_rss( 'http://twitter.com/statuses/user_timeline/49595711.rss' );

// start buffering output
ob_start();

$count = 1;
$now = time();


foreach ($rss->items as $item) {
// limit the number of tweets displayed
if ($tweets_to_display > 0) {
if ($count > $tweets_to_display) {
continue;
}
}
$tweet = $item['description'];
// ignore tweets linking back to page (if it is defined)
if ($page != "") {
if (!strpos($tweet, $page) === false) {
continue;
}
}
// figure out how recently the tweet was posted
$when = ($now - strtotime($item['pubdate']));
$posted = "";
if ($when < 60) {
$posted = $when . " seconds ago";
}
if (($posted == "") & ($when < 3600)) {
$posted = "about " . (floor($when / 60)) . " minutes ago";
}
if (($posted == "") & ($when < 7200)) {
$posted = "about 1 hour ago";
}
if (($posted == "") & ($when < 86400)) {
$posted = "about " . (floor($when / 3600)) . " hours ago";
}
if (($posted == "") & ($when < 172800)) {
$posted = "about 1 day ago";
}
if ($posted == "") {
$posted = (floor($when / 86400)) . " days ago";
}
// filter the user's username out of tweets
$tweet = str_replace($username . ": ", "", $tweet);
// turn URLs into hyperlinks
$tweet = preg_replace("/(http:\/\/)(.*?)\/([\w\.\/\&\=\?\-\,\:\;\#\_\~\%\+]*)/", "<a href=\"\\0\">Link</a>", $tweet);
// link to users in replies
$tweet = preg_replace("(@([a-zA-Z0-9\_]+))", "<a href=\"http://www.twitter.com/\\1\">\\0</a>", $tweet);
echo '<p class="Tweets"> <strong>'.$username.':</strong> '.$tweet.'</p><p class="TweetInfo">'.$posted.'</p>';
$count++;

}

// display output
ob_end_flush();
?>

Picassaness.php - This one is the most complex but doesn't require Magpierss which is cool, does the same grabs public xml, I've got it to store all the images in an array and select a random 5 and display them. (to change on each refresh):
(I adapted from - http://code.lawpower.net/2008/01/21/picasa-gallery-googles-cruel-rss-feed/)

<?php
$DisplayNumberofPhotos = 5;

function AddXMLtoItems($xmlurl){
//get the xml from the feed provided in $xmlurl
$session = curl_init($xmlurl);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);
$xml = simplexml_load_string($response);
$items = $xml->channel;

//now we have each item from the XML file into $items we now need to split them up so their more useful to us
foreach($items->item as $item){
$title = $item->title;
$content = $item->description;

//pull the images from the *descripotion* section
$quotes = array('"', "'", "\n");
$imgContents = str_replace($quotes, '', $content); #Strip " and ' as well as \n from input string
$imgContents = stristr($imgContents, 'src='); #Drop everything before the 'src'
$endTagPosition = stripos($imgContents, 'alt'); #Position of the end tag '>'
$img = substr($imgContents, 4, $endTagPosition - 4); #Get everything from src to end tag --> 'src="path" something>'

//Change the dimentions of the images, Picasa sets images sizes at specific sizes within the url
$ImageURL = str_replace('/s288', '/s220', $img);
$ImageURLs[] = $ImageURL;
}
return $ImageURLs;
}

//Grab the images from the array and merge them all into one big array...
$ImageURLs = AddXMLtoItems("http://picasaweb.google.com/data/feed/base/user/StartPlymouth/albumid/5354140273775432289?alt=rss&kind=photo&authkey=Gv1sRgCOGggY2Y8baMLw&hl=en_US");
//$ImageURLs2 = AddXMLtoItems("");
//$ImageURLs3 = AddXMLtoItems("");
//$ImageURLs4 = AddXMLtoItems("");
//$ImageURLs = array_merge((array)$ImageURLs1, (array)$ImageURLs2, (array)$ImageURLs3, (array)$ImageURLs4);

//Now we need to grab random images from this array to be displayed on the home page
for ( $counter = 0; $counter <= ($DisplayNumberofPhotos - 1); $counter += 1) {
//get ImageToDisplay to be a exact image number
$ImageToDisplay = sizeof($ImageURLs);
$ImageToDisplay = rand(0, $ImageToDisplay);
$ImageToDisplay = round($ImageToDisplay);
$ArrayofImagesBeenDisplayed[] = $ImageToDisplay;
}
//add image displayed to an array to ensure we don't get duplications
$ArrayofImagesBeenDisplayed = array_unique($ArrayofImagesBeenDisplayed);

//Display these random images and link them to a larger image
for ($counter2 = 0; $counter2 < sizeof($ArrayofImagesBeenDisplayed); $counter2 += 1) {
$ImageDisplayURL = $ImageURLs[$ArrayofImagesBeenDisplayed[$counter2]];
$ImageLinkURL = str_replace('/s220', '/s1024', $ImageURLs[$ArrayofImagesBeenDisplayed[$counter2]]);
echo "<a href='" . $ImageLinkURL . "'><img src='" . $ImageDisplayURL . "' /></a>";
}
?>


Obviously I'm no coder and I'm sure this will make some of you spit your coffee out at your computer screen, but I'm sure some of you will find it useful! Any feedback would be good. I've made these seporate files to be called into the main page by using Include('file.php'); so should hopefully work with you, for the picassa one you have to declare how many images you want displayed: $DisplayNumberofPhotos = 5; include('Picassaness.php') In the picassa one I would quite like it to find all rss feeds related to that piccassa user rather than having to list each individual album manually so if anyone knows how to do that, that would be great. Otherwise shall try and work it out myself and post it here.