Flickr

Soldato
Joined
18 Apr 2004
Posts
2,613
Location
London
I have been messing about with trying to load flickr images live from their rss feed into a php generated sig, and at last i've done it, any suggestions, comments or other ideas would be appreciated...

index.php


index.php
Code:
<?php
	
	header('Content-type: image/png');
	include_once('xmlparser.php');
	$xml = file_get_contents('http://www.flickr.com/services/feeds/photos_public.gne?id=62834984@N00&format=rss_200');
	$xml = str_replace('media:content', 'mediacontent', $xml);
	$xml = str_replace('media:title', 'mediatitle', $xml);
	$xml = str_replace('media:text', 'mediatext', $xml);
	$xml = str_replace('media:thumbnail', 'mediathumbnail', $xml);
	$xml = str_replace('media:credit', 'mediacredit', $xml);
	$xml = str_replace('media:category', 'mediacatergory', $xml);
	$parser = new XMLParser($xml);
	$parser->Parse();
	
	$image = imagecreatetruecolor(265, 95);
	
	$white = imagecolorallocate($image, 255, 255, 255);
	imagefill($image, 0, 0, $white);
	
		// Import 1
		$temp = imagecreatefromjpeg($parser->document->channel[0]->item[0]->mediathumbnail[0]->tagAttrs['url']);
		imagecopy($image, $temp, 10, 10, 0, 0, 75, 75);
		imagedestroy($temp);
		
		// Import 2
		$temp = imagecreatefromjpeg($parser->document->channel[0]->item[1]->mediathumbnail[0]->tagAttrs['url']);
		imagecopy($image, $temp, 95, 10, 0, 0, 75, 75);
		imagedestroy($temp);
		
		// Import 3
		$temp = imagecreatefromjpeg($parser->document->channel[0]->item[2]->mediathumbnail[0]->tagAttrs['url']);
		imagecopy($image, $temp, 180, 10, 0, 0, 75, 75);
		imagedestroy($temp);
		
	imagejpeg($image);

?>
 
Back
Top Bottom