Código PHP:
Ver original<?php
class Flickr {
private $apiKey = 'c933e0d66a6695d005d660392bc496f2';
public function img($id)
{
$url = 'http://www.flickr.com/services/rest/?api_key=' . $this->apiKey . '&format=php_serial&method=flickr.photos.getInfo&photo_id=' . $id;
$foto = $resultado[photo];
$foto_url = 'http://farm' . $foto[farm] . '.static.flickr.com/' . $foto[server] . '/' . $foto[id] . '_' . $foto[secret] . $tam . '.jpg';
$foto = '<a href="' . $foto[urls][url][0][_content] . '"><img src="' . $foto_url . '" alt="' . $foto[title][_content] . '" /></a>';
return $foto;
}
}
$flickr = new Flickr();
class BBcode {
function __construct(&$flickr)
{
$this->flickr =& $flickr;
}
function procesar($texto){
$a = "/\[img\](.*?)\[\/img\]/is";
return $texto;
}
public function process_img($matches)
{
$img_id = $matches[1];
$this->flickr->img($img_id);
}
}
$texto = 'Imagen 1:<br />';
$texto .= '[img]4398563145[/img]<br />';
$texto .= 'Imagen 2:<br />';
$texto .= '[img]4334520973[/img]';
$bbcode = new BBcode($flickr);
echo $bbcode->procesar($texto);