1. Go to this page and download the library: Download grubersjoe/bing-daily-photo 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/ */
// Fetches two images of the day starting yesterday from Bing
$bing = new BingPhoto([
'n' => 2,
'date' => BingPhoto::YESTERDAY
]);
foreach ($bing->getImages() as $image) {
printf('<img src="%s">', $image['url']);
}
// Fetches the current image of the day in low resolution from the French Bing portal
$bing = new BingPhoto([
'locale' => 'fr-FR',
'quality' => BingPhoto::QUALITY_LOW,
]);
printf('<img src="%s">', $bing->getImage()['url']);
// Fetches three images of the day in high quality from the German Bing portal, starting yesterday
$bing = new BingPhoto([
'n' => 3,
'date' => BingPhoto::YESTERDAY,
'locale' => 'de-DE',
'quality'r => BingPhoto::QUALITY_HIGH,
]);
foreach ($bing->getImages() as $image) {
printf('<img src="%s">', $image['url']);
}
// Fetches the current image of the day in portrait orientation
$bing = new BingPhoto([
'orientation' => BingPhoto::ORIENTATION_PORTRAIT
]);
// Using the local cache
$bing = new BingPhoto([
'cacheDir' => '/tmp/bing-photo',
'n' => 5,
'quality' => BingPhoto::QUALITY_LOW,
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.