2017 © Pedro PelĂĄez
 

library bingdailyphoto

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

image

telekommander/bingdailyphoto

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

  • Friday, September 1, 2017
  • by telekommander
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Bing Daily Photo

BingPhoto is a simple PHP class to fetch Bing's image of the day with meta data., (*1)

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:, (*2)

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();

The Versions

01/09 2017

1.0.0.x-dev

1.0.0.9999999-dev

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

  Sources   Download

MIT

The Requires

  • php >=5.6

 

bing

01/09 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

  • php >=5.6

 

bing

01/09 2017

1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

  • php >=5.6

 

bing