42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
|
|
<?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'
|
||
|
|
)
|
||
|
|
);
|