-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallPAPI.php
More file actions
46 lines (36 loc) · 1.12 KB
/
wallPAPI.php
File metadata and controls
46 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Created by JetBrains PhpStorm.
* User: mijahn
* Date: 14/06/13
* Time: 14:24
* To change this template use File | Settings | File Templates.
*/
namespace wallPAPI;
include 'vendor/autoload.php';
use DateTime;
use RestService\Server;
class wallPAPI {
private function createImage($filename) {
$file = file_get_contents($filename);
return $file;
}
public function returnImage() {
$dir = "wallpaper";
$image = array_diff(scandir($dir), array(".", ".."));
$imageArrayPosition = $this->oneMinuteInteger(count($image));
return $this->createImage($dir."/".$image[$imageArrayPosition]);
}
public function returnSmallImage() {
$dir = "wallpaper-android";
$image = array_diff(scandir($dir), array(".", ".."));
$imageArrayPosition = $this->oneMinuteInteger(count($image));
return $this->createImage($dir."/".$image[$imageArrayPosition]);
}
public function oneMinuteInteger($arraySize) {
$seed = floor(time()/60);
srand($seed);
$arrayPosition = rand(0,$arraySize);
return $arrayPosition;
}
}