rosco :3
This commit is contained in:
parent
4a39504f6c
commit
f0f87f2a04
13 changed files with 261 additions and 28 deletions
48
app/Http/Controllers/RoscoController.php
Normal file
48
app/Http/Controllers/RoscoController.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class RoscoController extends Controller {
|
||||
public function getImages(): array {
|
||||
$images = [];
|
||||
foreach (File::glob(public_path('images/rosco').'/*') as $path) {
|
||||
$image_data = [];
|
||||
try {
|
||||
$exif = exif_read_data($path);
|
||||
} catch (Exception $ex) {
|
||||
|
||||
}
|
||||
$image_data["path"] = str_replace(public_path(), '', $path);
|
||||
if (isset($exif)) {
|
||||
if (isset($exif["ImageDescription"])) {
|
||||
$image_data["description"] = $exif["ImageDescription"];
|
||||
}
|
||||
if (isset($exif["DateTime"])) {
|
||||
$image_data["date"] = strtotime($exif["DateTime"]);
|
||||
}
|
||||
}
|
||||
array_push($images, $image_data);
|
||||
}
|
||||
|
||||
usort($images, function ($a, $b) {
|
||||
$dateA = $a['date'] ?? PHP_INT_MIN;
|
||||
$dateB = $b['date'] ?? PHP_INT_MIN;
|
||||
return $dateB <=> $dateA;
|
||||
});
|
||||
|
||||
return $images;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the page
|
||||
* @return View
|
||||
*/
|
||||
public function show(): View {
|
||||
return view('rosco', [
|
||||
'images' => $this->getImages(),
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue