<?php
/**
* Flickr
*
* with help of the API this class delivers all kind of Images from flickr
*
* @package socialstreams
* @subpackage socialstreams/flickr
* @author ThemePunch <info@themepunch.com>
*/
class TP_flickr {
/**
* API key
*
* @since 1.0.0
* @access private
* @var string $api_key flickr API key
*/
private $api_key;
/**
* API params
*
* @since 1.0.0
* @access private
* @var array $api_param_defaults Basic params to call with API
*/
private $api_param_defaults;
/**
* Basic URL
*
* @since 1.0.0
* @access private
* @var string $url Url to fetch user from
*/
private $flickr_url;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $api_key flickr API key.
*/
public function __construct($api_key) {
$this->api_key = $api_key;
$this->api_param_defaults = array(
'api_key' => $this->api_key,
'format' => 'json',
'nojsoncallback' => 1,
);
}
/**
* Calls Flicker API with set of params, returns json
*
* @since 1.0.0
* @param array $params Parameter build for API request
*/
private function call_flickr_api($params){
//build url
$encoded_params = array();
foreach ($params as $k => $v){
$encoded_params[] = urlencode($k).'='.urlencode($v);
}
//call the API and decode the response
$url = "https://api.flickr.com/services/rest/?".implode('&', $encoded_params);
$rsp = json_decode(file_get_contents($url));
return $rsp;
}
/**
* Get User ID from its URL
*
* @since 1.0.0
* @param string $user_url URL of the Gallery
*/
public function get_user_from_url($user_url){
//gallery params
$user_params = $this->api_param_defaults + array(
'method' => 'flickr.urls.lookupUser',
'url' => $user_url,
);
//set User Url
$this->flickr_url = $user_url;
//get gallery info
$user_info = $this->call_flickr_api($user_params);
return $user_info->user->id;
}
/**
* Get Group ID from its URL
*
* @since 1.0.0
* @param string $group_url URL of the Gallery
*/
public function get_group_from_url($group_url){
//gallery params
$group_params = $this->api_param_defaults + array(
'method' => 'flickr.urls.lookupGroup',
'url' => $group_url,
);
//set User Url
$this->flickr_url = $group_url;
//get gallery info
$group_info = $this->call_flickr_api($group_params);
return $group_info->group->id;
}
/**
* Get Public Photos
*
* @since 1.0.0
* @param string $user_id flicker User id (not name)
* @param int $item_count number of photos to pull
*/
public function get_public_photos($user_id,$item_count=10){
//public photos params
$public_photo_params = $this->api_param_defaults + array(
'method' => 'flickr.people.getPublicPhotos',
'user_id' => $user_id,
'extras' => 'description, license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o',
'per_page'=> $item_count,
'page' => 1
);
//get photo list
$public_photos_list = $this->call_flickr_api($public_photo_params);
return $public_photos_list->photos->photo;
}
/**
* Get Photosets List from User
*
* @since 1.0.0
* @param string $user_id flicker User id (not name)
* @param int $item_count number of photos to pull
*/
public function get_photo_sets($user_id,$item_count=10){
//photoset params
$photo_set_params = $this->api_param_defaults + array(
'method' => 'flickr.photosets.getList',
'user_id' => $user_id,
'per_page'=> $item_count,
'page' => 1
);
//get photoset list
$photo_sets_list = $this->call_flickr_api($photo_set_params);
return $photo_sets_list->photosets->photoset;
}
/**
* Get Photoset Photos
*
* @since 1.0.0
* @param string $photo_set_id Photoset ID
* @param int $item_count number of photos to pull
*/
public function get_photo_set_photos($photo_set_id,$item_count=10){
//photoset photos params
$photo_set_params = $this->api_param_defaults + array(
'method' => 'flickr.photosets.getPhotos',
'photoset_id' => $photo_set_id,
'per_page' => $item_count,
'page' => 1,
'extras' => 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o'
);
//get photo list
$photo_set_photos = $this->call_flickr_api($photo_set_params);
return $photo_set_photos->photoset->photo;
}
/**
* Get Groop Pool Photos
*
* @since 1.0.0
* @param string $group_id Photoset ID
* @param int $item_count number of photos to pull
*/
public function get_group_photos($group_id,$item_count=10){
//photoset photos params
$group_pool_params = $this->api_param_defaults + array(
'method' => 'flickr.groups.pools.getPhotos',
'group_id' => $group_id,
'per_page' => $item_count,
'page' => 1,
'extras' => 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o'
);
//get photo list
$group_pool_photos = $this->call_flickr_api($group_pool_params);
return $group_pool_photos->photos->photo;
}
/**
* Get Gallery ID from its URL
*
* @since 1.0.0
* @param string $gallery_url URL of the Gallery
* @param int $item_count number of photos to pull
*/
public function get_gallery_from_url($gallery_url){
//gallery params
$gallery_params = $this->api_param_defaults + array(
'method' => 'flickr.urls.lookupGallery',
'url' => $gallery_url,
);
//get gallery info
$gallery_info = $this->call_flickr_api($gallery_params);
return $gallery_info->gallery->id;
}
/**
* Get Gallery Photos
*
* @since 1.0.0
* @param string $gallery_id flicker Gallery id (not name)
* @param int $item_count number of photos to pull
*/
public function get_gallery_photos($gallery_id,$item_count=10){
//gallery photos params
$gallery_photo_params = $this->api_param_defaults + array(
'method' => 'flickr.galleries.getPhotos',
'gallery_id' => $gallery_id,
'extras' => 'description, license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o',
'per_page'=> $item_count,
'page' => 1
);
//get photo list
$gallery_photos_list = $this->call_flickr_api($gallery_photo_params);
return $gallery_photos_list->photos->photo;
}
/**
* Encode the flickr ID for URL (base58)
*
* @since 1.0.0
* @param string $num flickr photo id
*/
public static function base_encode($num, $alphabet='123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ') {
$base_count = strlen($alphabet);
$encoded = '';
while ($num >= $base_count) {
$div = $num/$base_count;
$mod = ($num-($base_count*intval($div)));
$encoded = $alphabet[$mod] . $encoded;
$num = intval($div);
}
if ($num) $encoded = $alphabet[$num] . $encoded;
return $encoded;
}
}
?>
没有合适的资源?快使用搜索试试~ 我知道了~
公司级网站源码-团队服务动态展示响应式网页模板-支持适配移动端.zip
共185个文件
js:41个
css:31个
php:23个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 110 浏览量
2024-03-23
12:33:07
上传
评论
收藏 4.74MB ZIP 举报
温馨提示
打造企业级网站,源码在手,天下我有!移动端完美适配 — 在这个以手机为王的时代,我们的HTML源码专为移动设备优化,确保你的企业网站无论在大屏还是小屏上都能流畅展现,抓住移动互联网的巨量流量。专业企业设计 — 每行代码都经过精心设计与优化,兼顾美观与性能。让你的网站不仅拥有专业的外观,还能提供快速的加载速度和优秀的用户体验。 高度可定制 — 这份源码易于修改和扩展,让你随心所欲地定制功能和样式,无需担心技术难题。 SEO优化结构 — 良好的SEO结构让你的网站更容易被搜索引擎发现,提升品牌曝光度,带来更多潜在客户。作为一名程序员,时间就是金钱,效率就是生命。合理利用模板,让你的项目开发事半功倍,立刻启动你的互联网成功之旅!你将节省无数宝贵时间和避免潜在的开发坑洞,快速部署一个高效、吸引人且响应式的企业网站。现在行动,让你的业务在数字世界中翱翔!
资源推荐
资源详情
资源评论
收起资源包目录
公司级网站源码-团队服务动态展示响应式网页模板-支持适配移动端.zip (185个子文件)
info.cfg 23B
layers.css 143KB
bootstrap.min.css 124KB
animate.css 71KB
navigation.css 58KB
style.css 45KB
font-awesome.css 41KB
settings-ver.5.3.1.css 38KB
font-awesome.min.css 30KB
settings.css 29KB
font-awesome.min.css 28KB
style.css 25KB
themify-icons.css 16KB
pe-icon-7-stroke.css 10KB
responsive.css 6KB
erinyen.css 6KB
zeus.css 6KB
gyges.css 6KB
hades.css 6KB
metis.css 5KB
hermes.css 5KB
ares.css 5KB
dione.css 4KB
hesperiden.css 4KB
hebe.css 4KB
helper.css 4KB
owl.carousel.min.css 3KB
uranus.css 2KB
hephaistos.css 2KB
persephone.css 1KB
custom.css 1KB
owl.theme.default.min.css 936B
closedhand.cur 326B
openhand.cur 326B
.DS_Store 8KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
fontawesome-webfont.eot 162KB
fontawesome-webfont.eot 162KB
themify.eot 77KB
ElegantIcons.eot 58KB
Pe-icon-7-stroke.eot 57KB
revicons.eot 12KB
loader.gif 2KB
index.html 39KB
static.html 20KB
contact-us.html 18KB
service-bg.jpg 237KB
slider-1.jpg 134KB
banner-1.jpg 132KB
project-bg.jpg 98KB
feature-right.jpg 72KB
static-1.jpg 70KB
l-news-1.jpg 30KB
l-news-3.jpg 24KB
l-news-2.jpg 20KB
jquery.themepunch.tools.min.js 382KB
jquery.themepunch.tools.min.js 105KB
jquery.themepunch.revolution.js 103KB
jquery-3.2.1.min.js 85KB
revolution.extension.layeranimation.js 81KB
jquery.themepunch.revolution.min.js 61KB
revolution.extension.slideanims.js 51KB
bootstrap.min.js 49KB
revolution.extension.layeranimation.min.js 49KB
revolution.extension.navigation.js 42KB
owl.carousel.min.js 42KB
revolution.extension.video.js 40KB
jquery.form.js 40KB
gmaps.min.js 31KB
revolution.extension.slideanims.min.js 28KB
revolution.extension.navigation.min.js 25KB
revolution.extension.video.min.js 23KB
jquery.validate.min.js 21KB
popper.min.js 19KB
revolution.extension.parallax.js 16KB
revolution.extension.actions.js 13KB
revolution.extension.carousel.js 12KB
theme.js 12KB
revolution.extension.parallax.min.js 10KB
jquery.waypoints.min.js 9KB
revolution.extension.actions.min.js 9KB
revolution.extension.migration.js 8KB
revolution.extension.carousel.min.js 7KB
revolution.extension.migration.min.js 6KB
revolution.extension.kenburn.js 5KB
countto.js 3KB
revolution.extension.kenburn.min.js 3KB
contact.js 3KB
tweetie.min.js 2KB
script.js 2KB
jquery.parallax-1.1.3.js 2KB
apear.js 1KB
jquery.counterup.min.js 1KB
scripts.min.js 671B
共 185 条
- 1
- 2
资源评论
DTcode7
- 粉丝: 3w+
- 资源: 4986
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 案例分析:研发人员绩效和薪酬管理的困境.doc
- 企业中薪酬管理存在的问题分析及对策.doc
- 员工年度薪酬收入结构分析报告.doc
- 薪酬分析报告.docx
- 西门子S7-1200控制四轴伺服程序案例: 1.内容涵盖伺服,步进点动,回原,相对定位,绝对定位,速度模式控制 特别适合学习伺服和步进的朋友们 PTO伺服轴脉冲定位控制+速度模式控制+扭矩模式; 2
- 企业公司薪酬保密协议.doc
- 薪酬保密制度 (1).docx
- 薪酬保密管理规定制度.doc
- 薪酬保密制度.docx
- 薪酬保密协议书.docx
- 薪酬保密承诺书.docx
- 薪酬管理制度.doc
- 员工工资薪酬保密协议.docx
- 员工工资保密暂行管理条例.docx
- 员工薪酬保密协议.doc
- 1Redis基础认识与安装.html
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功