protected function configure() { $d = new Flickr(); $foo = $d->searchPhotos('cat'); $this->title = 'Welcome to iFlickr'; $this->images = $foo; }
public function testGetAuthor() { $flickr = new Flickr(6122735488); $author = $flickr->getAuthor(); $this->assertEquals('Jeff Kubina', $author['username'], 'Falschen/Keinen Author erhalten'); $this->assertEquals('https://www.flickr.com/photos/kubina/6122735488/', $author['linkPicture'], 'Falsches/Kein linkPicture erhalten'); }
public function action_results() { $search_term = Input::get('search-term'); $search_term = urlencode($search_term); $flickr = new Flickr('055a3d9b90dfae0f8db89d7c7c6d6a5c'); $flickr_search = $flickr->searchPhotosByTerm($search_term); //dd($flickr_search); $data = array('search_term' => $search_term, 'results' => $flickr_search->photos->photo); return View::make('home.results', $data); }
function testNET_API_Flickr() { $Flickr = new Flickr("199d34f644d1c9424660bd91c1356238", "fd14718eafbc1ce7"); $res = $Flickr->GetFrob(); $this->assertTrue($res, "Frob received"); if (!$res) { print Core::GetLastWarning() . "<br>"; } $res = $Flickr->Login(); var_dump($res); }
/** * @return array */ public function getRecentPhotos() { $flickrApi = Flickr::getInstance(); $this->query = $flickrApi->getQuery(); $allPhotos = $flickrApi->getCurl($this->query); foreach ($allPhotos->photos->photo as $firstKey => $photo) { $this->sizes[] = $this->getSizes($photo->id); /**/ $this->url[] = $this->getUrl($this->sizes[$firstKey][0]->url); foreach ($this->sizes[$firstKey] as $key => $value) { if ($value->label === 'Large') { $this->bigImgUrl[$firstKey] = $value->source; } else { if ($value->label === 'Original') { $this->bigImgUrl[$firstKey] = $value->source; } } } } $this->array[0] = $allPhotos->photos->photo; $this->array[1] = $this->sizes; $this->array[2] = $this->url; $this->array[3] = $this->bigImgUrl; return $this->array; }
$tags_list = $show->getByTags($tag, true); } else { $tags_list = $show->getByTags($tag); } for ($i = 0; $i < count($tags_list); $i++) { $tags_list[$i][content] = format_ubb($tags_list[$i][content]); $view->assign('tags', $tags_list); } $content->save($tags_list, 'tags_list'); } else { $view->assign('tags', $tags_list); } /* Flickr cache */ require_once 'models/Flickr.class.php'; if (!($flickr = $cache->load('flickr'))) { $flickr = Flickr::output("schema/Flickr.xml"); $view->assign('flickr', $flickr); $cache->save($flickr, 'flickr'); } else { $view->assign('flickr', $flickr); } $view->display('tags.tpl'); break; case 'post': check_login(); $view->display('post.tpl'); break; case 'about': $view->display('about.tpl'); break; case 'manage':
<?php require 'include/init.php'; $flickr = new Flickr($GLOBALS['cfg']['flickr_key'], $GLOBALS['cfg']['flickr_secret']); $result = $flickr->call_method('flickr.auth.getToken', array('frob' => $_GET['frob']), true); $_SESSION['flickr_token'] = $result; header('Location: index.php'); exit;
<?php require '../src/Curl/Curl.php'; require 'flickr.class.php'; use Curl\Curl; $flickr = new Flickr(); $flickr->authenticate(); ?> <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Flickr Photo Upload</title> </head> <body> <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { $result = $flickr->uploadPhoto(); if ($result->error) { echo '<p>Photo upload failed.</p>'; } else { $user_id = $_SESSION['user_id']; $photo_id = $result->response->photoid; $photo_url = 'http://www.flickr.com/photos/' . $user_id . '/' . $photo_id; echo '<p>Photo uploaded successfully. <a href="' . $photo_url . '">View photo</a>.</p>'; } } ?> <form enctype="multipart/form-data" method="post">
<?php require_once 'includes/settings.php'; require_once 'includes/classes/Flickr.php'; require_once 'includes/db.php'; $flickr = new Flickr(FLICKR_KEY, FLICKR_SECRET); $data = $flickr->search('mcdonald'); foreach ($data['photos']['photo'] as $photo) { echo '<a href="https://www.flickr.com/photos/' . $photo["owner"] . '/' . $photo["id"] . '" target="_blank"><img src="' . 'http://farm' . $photo["farm"] . '.static.flickr.com/' . $photo["server"] . '/' . $photo["id"] . '_' . $photo["secret"] . '_t.jpg"></a>'; }
<?php require 'include/init.php'; $_SESSION = array(); ini_set('display_errors', true); error_reporting(E_ALL); # We don't know who they are. Make them log back in! $flickr = new Flickr($GLOBALS['cfg']['flickr_key'], $GLOBALS['cfg']['flickr_secret']); $args = array('api_key' => $GLOBALS['cfg']['flickr_key'], 'perms' => 'write'); $request_url = $flickr->_request_url('http://www.flickr.com/services/auth/?', $args, true); global_redirect($request_url);
<?php require 'flickr.php'; $bbt_flickr = new Flickr('055a3d9b90dfae0f8db89d7c7c6d6a5c'); $bbt_search = $bbt_flickr->searchPhotosByTerm('Big Bang Theory'); // display the photos foreach ($bbt_search as $photo) { $id = $photo['id']; $farm = $photo['farm']; $secret = $photo['secret']; $server_id = $photo['server']; $img_src = "http://farm" . $farm . ".staticflickr.com/" . $server_id . "/" . $id . "_" . $secret . "_m.jpg"; echo '<img src="' . $img_src . '" />'; }
public function __construct($api_key = null) { parent::__construct($api_key); $this->method = str_replace('\\', '.', strtolower(get_class())); }
<?php include '../include/config.php'; include '../flickr.php'; $id = $_POST['id']; if ($id == null || $id == 0) { $id = '6122735488'; } $flickr = new Flickr($id); $result = null; $result['url'] = $flickr->getImage(); $result['author'] = $flickr->getAuthor(); echo json_encode($result);
public function filter_shortcode_flickr($code_to_replace, $code_name, $attr_array, $code_contents, $post) { $id = $attr_array['id']; $size = isset($attr_array['size']) ? '_' . $attr_array['size'] : Options::get('flickrsilo__flickr_size'); $info = "flickr{$id}"; $flickr = $post->info->{$info}; $f = new Flickr(array('user_id' => $post->author->id)); if (!$flickr) { // this photo's details aren't cached on this post. Let's grab 'em $xml = $f->photosGetInfo($id); if (!$xml->photo) { return $code_to_replace; } // get an array of the 'photo' element from the XML $p = (array) $xml->photo->attributes(); $flickr = $p['@attributes']; // stuff in the URL to the photopage $flickr['photopage'] = (string) $xml->photo->urls[0]->url[0]; // and if it's a video, we want its dimensions if ('video' == $flickr['media']) { if (0 == $xml->photo->video['ready']) { return $code_to_replace; } $flickr['height'] = (string) $xml->photo->video->attributes()->height; $flickr['width'] = (string) $xml->photo->video->attributes()->width; } // cache this array on this post $post->info->{$info} = $flickr; $post->update(); } if ('photo' == $flickr['media']) { $markup = '<a href="' . $flickr['photopage'] . '">'; $markup .= '<img src="'; $markup .= $f->getPhotoURL($flickr, $size); $markup .= '"'; if (isset($attr_array['class'])) { $markup .= ' class="' . $attr_array['class'] . '"'; } $markup .= '></a>'; } else { $photo_id = $flickr['id']; $secret = $flickr['secret']; $height = $flickr['height']; $width = $flickr['width']; $markup = <<<EOF <object type="application/x-shockwave-flash" width="{$width}" height="{$height}" data="//www.flickr.com/apps/video/stewart.swf?v=109786" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="intl_lang=en-us&photo_secret={$secret}&photo_id={$id}&flickr_show_info_box=true&hd_default=false"></param> <param name="movie" value="//www.flickr.com/apps/video/stewart.swf?v=109786"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="//www.flickr.com/apps/video/stewart.swf?v=109786" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&photo_secret={$secret}&photo_id={$id}&flickr_show_info_box=true&hd_default=false" height="{$height}" width="{$width}"></embed></object> EOF; } return $markup; }
require_once './wordsBreaker.php'; include_once './downloadflickr.php'; require_once './flickrTag.php'; require_once './flickrTagRelated.php'; require_once './googleDownloader.php'; $start = microtime(true); $count1 = 0; $count2 = 0; $count3 = 0; $count4 = 0; global $imgid; ############################################################### # Initialize Classes ############################################################### $downloadIMAGE = new downloadIMAGE(); $Flickr = new Flickr(); $TAG = new TAG(); $FlickrRelated = new FlickrRalated(); $google = new google(); ############################################################### # Get images ids ############################################################### /*$keywords = ['big+backpack','white+backpack','blue+bacpack']; for ($c=0;$c<sizeof($keywords);$c++){ $data = $google->queryengine($keywords[$c]); print_r($data); echo '<br/><br/>'; } exit;*/ if (!empty($addMe)) {
public function exif($type = false) { if(!$this->_exif) { $response = Flickr::call(array( 'method' => 'flickr.photos.getExif', 'photo_id' => $this->_id, 'secret' => $this->_secret ),86400); $exifs = $response['photo']['exif']; if($exifs) { foreach($exifs as $ex) { if($ex['tag'] === 'FNumber' && $ex['tagspace'] === 'ExifIFD') { $this->_exif['aperture'] = (float)$ex['raw']['_content']; } elseif(!$this->_exif['aperture'] && $ex['tag'] === 33437) { $a = explode('/',$ex['clean']['_content']); $this->_exif['aperture'] = (float)$a[1]; } if($ex['tag'] === 'ExposureTime' && $ex['tagspace'] === 'ExifIFD') { $this->_exif['exposure'] = $ex['raw']['_content']; } elseif(!$this->_exif['exposure'] && $ex['tag'] === 33434) { $this->_exif['exposure'] = $ex['raw']['_content']; } if($ex['tag'] === 'FocalLength' && $ex['tagspace'] === 'ExifIFD') { $a = explode(' ',$ex['raw']['_content']); $this->_exif['focal_length'] = (float)$a[0]; } elseif(!$this->_exif['focal_length'] && $ex['tag'] === 37386) { $a = explode(' ',$ex['clean']['_content']); $this->_exif['focal_length'] = (float)$a[0]; } if($ex['tag'] === 'ISO' && $ex['tagspace'] === 'ExifIFD') { $this->_exif['iso'] = (int)$ex['raw']['_content']; } elseif(!$this->_exif['iso'] && $ex['tag'] === 34855) { $this->_exif['iso'] = (int)$ex['raw']['_content']; } } } } if(!$type) { return ($this->_exif['aperture'] || $this->_exif['exposure'] || $this->_exif['focal_length'] || $this->_exif['iso']); } return $this->_exif[$type] ? $this->_exif[$type] : false; }
<?php include 'flickr.simple.php'; $key = '-your-key-here-'; $secret = '-your-secret-here-'; $flickr = new Flickr($key, $secret); # request a token with write level permission echo $flickr->auth_shell('write');
<?php require 'include/init.php'; if (!global_check_login()) { global_redirect('index.php'); } $topics = array("contacts_photos" => "Contacts' Photos", "contacts_faves" => "Contacts' Faves", "photos_of_contacts" => "Photos of my Contacts", "photos_of_me" => "Photos of Me", "my_photos" => "My Photos", "my_faves" => "My Faves", "geo" => "Geo", "commons" => "Commons", "tags" => "Tags"); $user_nsid = $cfg['account']['auth']['user']['nsid']; $token = $cfg['account']['auth']['token']['_content']; $flickr = new Flickr($cfg['flickr_key'], $cfg['flickr_secret']); // What does Flickr say we are subscribed to? $subscriptions = $flickr->call_method('flickr.push.getSubscriptions', array('auth_token' => $token), 1); $live_subscriptions = array(); $active_subscriptions = array(); // Figure out what we are currently subscribed to so we'll know what we need to add from the passed-in form data if (isset($subscriptions['subscriptions']['subscription'])) { foreach ($subscriptions['subscriptions']['subscription'] as $sub) { if (strpos($sub['callback'], $cfg['base_push_url']) === 0) { $pieces = explode('&', parse_url($sub['callback'], PHP_URL_QUERY)); foreach ($pieces as $piece) { list($k, $v) = explode('=', $piece, 2); if ($k == 'sub') { $live_subscriptions[$v] = 1; } } } } } $titles = array(); foreach ($_POST['streams'] as $topic) { switch ($topic) {
private function is_auth() { static $flickr_ok = null; if ( isset( $flickr_ok ) ){ return $flickr_ok; } $flickr_ok = false; $token = Options::get( 'flickr_token_' . User::identify()->id ); if ( $token != '' ){ $flickr = new Flickr(); $result = $flickr->call( 'flickr.auth.checkToken', array( 'api_key' => $flickr->key, 'auth_token' => $token ) ); if ( isset( $result->auth->perms ) ){ $flickr_ok = true; $_SESSION['nsid'] = (string)$result->auth->user['nsid']; } else{ Options::set( 'flickr_token_' . User::identify()->id ); unset( $_SESSION['flickr_token'] ); } } return $flickr_ok; }
/** * Método indicado desde JS como responsable de retornar el html, en este caso utiliza una API de flickr y saca un conjunto de fotos */ function ajax__album_flickr($tag, toba_ajax_respuesta $respuesta) { if (!extension_loaded('curl')) { $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : ''; @dl($prefix . 'curl.' . PHP_SHLIB_SUFFIX); if (!extension_loaded('curl')) { echo 'Se necesita instalar la extensión <strong>curl</strong> para acceder al API de Flickr'; return; } } require_once 'lib/flickr_api.php'; $secrets = array('api_key' => 'e5ec32dadfbc7f48fa476a1d62a5c251', 'api_secret' => '579da1ad011ef233'); $flickr = new Flickr($secrets); $photos = $flickr->photosSearch('', $tag); $html = ''; if ($photos && $photos['total'] > 0) { $i = 0; $modulo = 4; $html .= '<table>'; foreach ($photos['photos'] as $photo) { if ($i == 12) { break; } if ($i % $modulo == 0) { $html .= "<tr>\n"; } $url_chica = $flickr->getPhotoURL($photo, 's'); $url_full = 'http://flickr.com/photos/' . $photo['owner'] . '/' . $photo['id']; $html .= "<td><a title='Ver foto' href='{$url_full}' target='_blank'><img src='{$url_chica}' height=75 width=75/></a></td>"; $i++; if ($i % $modulo == 0) { $html .= "</tr>\n"; } } $html .= '</table>'; $html .= "<div style='text-align:center'><em>Mostrando " . $i . ' de ' . $photos['total'] . ' fotos...</em></div>'; } else { $html .= "No se encontraron fotos con el tag <strong>{$tag}</strong>."; } $respuesta->set($html); }
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (array_key_exists('flickr', $_POST)) { require_once "inc/Flickr.php"; $flickr = new Flickr(); $photos = $flickr->getFlickrData(); header("Content-Type: application/json"); echo $photos; die; } } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="initial-scale=1,minimum-scale=1,width=device-width"> <link rel="stylesheet" href="css/default.css" type="text/css" media="screen" /> <title>Flickr Test</title> </head> <body> <header></header> <section id="images" class="inner-container"></section> <footer></footer>
public function __construct($config) { parent::setVariables($config); if (!is_array($config['tags'])) { $config['tags'] = explode(',', $config['tags']); } $maintag = $config['tags'][0]; $config['tags'] = implode(',', $config['tags']); $this->setURL(sprintf('http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=%s&tags=%s&sort=%s&per_page=%d&extras=owner_name,path_alias', $config['key'], $config['tags'], $this->sort, $config['total'])); $this->setURLTemplate('http://www.flickr.com/photos/tags/' . $maintag . '/'); parent::__construct($config); }
<?php require_once 'includes/settings.php'; require_once 'includes/classes/Flickr.php'; //Create instance of class to use for communicating with Flickr webservice $flickr = new Flickr(FLICKR_KEY, FLICKR_SECRET); //First step to define the returnData to the client $returnData = []; //Set the header so the client will know what to expect. header("Content-Type: application/json"); //Check to see if the server connects properly try { $connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE); } catch (Exception $e) { //Output JSON to the outside world with 501 error header("HTTP/1.1 500 Internal Server Error"); echo json_encode(["error" => "Database connection failed: " . $e->getMessage()]); exit; } //Check to see if id from image is set $id = isset($_GET['id']) ? $connection->real_escape_string($_GET['id']) : false; //Build query depending on parameter state $query = "SELECT id, name, recipe FROM dishes"; if ($id != false) { $query .= " WHERE id='{$id}'"; } //Execute query & fetch result $result = $connection->query($query); //Meta information about the returnData $returnData['meta'] = ["request_uri" => $_SERVER['REQUEST_URI'], "query" => $query, "row_count" => $result->num_rows]; //Merge the data from the database with the images from flickr into the newly created returnData
public static function getNSID() { if(!self::$_nsid) { self::$_nsid = ereg('^[0-9]+@[A-Z]{1}[0-9]+$',$_GET['user']) ? $_GET['user'] : Flickr::NSIDforURLname($_GET['user']); } return self::$_nsid; }
<?php require_once 'flickr.php'; $Flickr = new Flickr(); if (!empty($_GET['q'])) { // Remove any hack attempts from input data $search_term = htmlspecialchars($_GET['q']); $search_term = $_GET['q']; $flickr_stream = ''; $data = $Flickr->search($search_term); foreach ($data['photos']['photo'] as $photo) { // The geolocation information $photo_latlong = array("latitude" => $photo['latitude'], "longitude" => $photo['longitude']); // the image URL becomes somthing like // http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg $flickr_html = '<a href="http://www.flickr.com/photos/' . $photo["owner"] . '/' . $photo["id"] . '/" target="_blank" rel="nofollow" data-geo=\'' . json_encode($photo_latlong) . '\'><img border="0" src="http://farm' . $photo["farm"] . '.static.flickr.com/' . $photo["server"] . '/' . $photo["id"] . '_' . $photo["secret"] . '.jpg" width="150" /></a>'; $flickr_stream .= $flickr_html; } // Add the google map HTML $flickr_stream .= '<div id="google-map"></div>'; print $flickr_stream; } else { print 'No search terms found'; }
<?php require_once 'includes/settings.php'; require_once 'includes/classes/Flickr.php'; $flickr = new Flickr(FLICKR_KEY, FLICKR_SECRET); $data = $flickr->search('sun');