initial
This commit is contained in:
41
generate.php
Normal file
41
generate.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// todo: look for images in a directory
|
||||||
|
// for each image, see if a thumbnail exists in a thumbnail subdirectory
|
||||||
|
|
||||||
|
$photos = [];
|
||||||
|
|
||||||
|
foreach (scandir('./images') as $inode) {
|
||||||
|
var_dump($inode);
|
||||||
|
|
||||||
|
$file_name = basename($inode);
|
||||||
|
|
||||||
|
if ( ! file_exists("./images/thumbnails/$file_name")) {
|
||||||
|
// todo: make thumbnail - needs imagick/gd or something
|
||||||
|
}
|
||||||
|
|
||||||
|
// maybe each photo can have a text file associated with it, for a description / alt text / etc?
|
||||||
|
// can this be stored in jpeg metadata?
|
||||||
|
|
||||||
|
// could generate a "view photo on its own" kinda HTML page with a mid-size version of the photo
|
||||||
|
|
||||||
|
$photos[] = sprintf(
|
||||||
|
'
|
||||||
|
<div class="photo">
|
||||||
|
<a href="%s">
|
||||||
|
<img src="%s" alt="%s">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
',
|
||||||
|
'todo: full-size image or photo page',
|
||||||
|
'todo: thumbnail filename',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents(
|
||||||
|
'index.html',
|
||||||
|
sprintf(
|
||||||
|
file_get_contents('template.html'),
|
||||||
|
'Whee'
|
||||||
|
)
|
||||||
|
);
|
||||||
15
template.html
Normal file
15
template.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-gb">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Photos</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Photos</h1>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
%s
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user