Delete .gitignore, composer.json, downloader.php

This commit is contained in:
Ceda EI 2018-04-02 01:59:07 +05:30
parent 52bb6091d4
commit 7f115f3d68
3 changed files with 0 additions and 53 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
vendor/
composer.lock

View File

@ -1,5 +0,0 @@
{
"require": {
"crewlabs/unsplash": "^2.4"
}
}

View File

@ -1,46 +0,0 @@
#!/usr/bin/env php
<?php
require __DIR__.'/vendor/autoload.php';
# Initialize API
Crew\Unsplash\HttpClient::init([
'applicationId' => file_get_contents(getenv('HOME').'/i3lock-delta/api_key'),
'utmSource' => 'i3lock-Delta'
]);
# Get custom search queries
$queries_file_name = getenv('HOME') . '/.config/lock_preferences';
$queries = file($queries_file_name);
# Create the random photo limitations
if (count($queries) == 0){
$filters = [
'featured' => false,
'orientation' => 'landscape'
];
}
else {
$filters = [
'featured' => false,
'query' => $queries[rand(0,count($queries) - 1)],
'orientation' => 'landscape'
];
}
# Get the random photo
$img = Crew\Unsplash\Photo::random($filters);
# Download the photo
$url = $img->download();
$output = file_get_contents($url);
# Write image to a file
$image_filename =getenv('HOME') . '/.rand_bg';
$image_file = fopen($image_filename, 'w');
fwrite($image_file, $output);
fclose($image_file);
# Write author's name to a file
$name_file = fopen('/tmp/name_photographer', 'w');
fwrite($name_file, $img->{'user'}['name']);
fclose($name_file);