承接 telekommander/bingdailyphoto 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

telekommander/bingdailyphoto

Composer 安装命令:

composer require telekommander/bingdailyphoto

包简介

BingPhoto is a simple PHP class to fetch Bing's image of the day with meta data.

关键字:

README 文档

README

BingPhoto is a simple PHP class to fetch Bing's image of the day with meta data.

Basic usage

$bing = new BingPhoto();
$image = $bing->getImage();

// Example result ($image)
[
    [startdate] => '20160913'
    [fullstartdate] => '201609130700'
    [enddate] => '20160914'
    [url] => 'http://www.bing.com/az/hprichbg/rb/Meteora_EN-US6763889417_1920x1080.jpg'
    [urlbase] => '/az/hprichbg/rb/Meteora_EN-US6763889417'
    [copyright] => 'Roussanou and other monasteries in Metéora, Greece (© Stian Rekdal/Nimia)'   
    // ...
]

Parameters

The class has some optional parameters to control various options:

Parameter Description Default Valid values
$date Date of photo BingPhoto::DATE_TODAY BingPhoto::DATE_YESTERDAY, BingPhoto::DATE_TODAY, BingPhoto::DATE_TOMORROW, any integer >= -1
$n Number of photos to fetch, going from date backwards 1 1 - 8
$locale Locale code en-US Whatever language Bing supports
$resolution Image resolution BingPhoto::RESOLUTION_HIGH BingPhoto::RESOLUTION_LOW, BingPhoto::RESOLUTION_HIGH

Examples

// Fetches two images of the day in high resolution from the American Bing portal
// Composer autoloader first
require __DIR__ . "/vendor/autoload.php";
// Here we go
use BingPhoto\BingPhoto;
$bing = new BingPhoto(BingPhoto::YESTERDAY, 2);
$images = $bing->getImages();
// Fetches three images of the day in low resolution, starting yesterday from the French Bing portal
// Composer autoloader first
require __DIR__ . "/vendor/autoload.php";
// Here we go
use BingPhoto\BingPhoto;
$bing = new BingPhoto(BingPhoto::YESTERDAY, 3, 'fr-FR', BingPhoto::RESOLUTION_LOW);
foreach ($bing->getImages() as $image) {
    printf('<img src="%s">', $image['url']);
}
// Output the image of the day as an image in high resolution
// Composer autoloader first
require __DIR__ . "/vendor/autoload.php";
// Here we go
use BingPhoto\BingPhoto;
$bing       = new BingPhoto(BingPhoto::TODAY, 1, 'de-DE', BingPhoto::RESOLUTION_HIGH);
$current    = $bing->getImage();
$info       = getimagesize($current['url']);

header("Content-type: " . $info["mime"]);
readfile($current['url']);
die();

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固