PHP code example of telekommander / bingdailyphoto

1. Go to this page and download the library: Download telekommander/bingdailyphoto library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

telekommander / bingdailyphoto example snippets


$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)'   
    // ...
]

// Fetches two images of the day in high resolution from the American Bing portal
// Composer autoloader first
ges();

// Fetches three images of the day in low resolution, starting yesterday from the French Bing portal
// Composer autoloader first
h ($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
e-DE', BingPhoto::RESOLUTION_HIGH);
$current    = $bing->getImage();
$info       = getimagesize($current['url']);

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