This commit is contained in:
vulpine 2020-12-13 21:31:34 -05:00
parent 860cbdd42d
commit 97855bdf6c
3 changed files with 53 additions and 7 deletions

View File

@ -16,18 +16,21 @@ max-width: 700px;
margin: 0 auto;
}
a {
color: #aac;
}
h1 a {
text-decoration: none;
color: #cdcdcd;
}
a::before {
h1 a::before {
content: "#";
color: #acc;
color: #aac;
margin-right: 10px;
}
a:hover::before {
h1 a:hover::before {
text-decoration: underline;
}

View File

@ -6,19 +6,20 @@
<meta name="description" content="a tiny php script to automagically display photos">
<title>p-view</title>
<h1>p-view</h1>
tiny script to automagically display all the photos in a directory with php
tiny script to automagically display all the photos in a directory with php.
<a href='rss.php'>rss!</a>
<div class='wrapper'>
<?php
$images = glob("i/*.{png,jpg,JPG}", GLOB_BRACE);
$images = glob("src/*.{png,jpg,JPG}", GLOB_BRACE);
usort( $images, function( $b, $a ) { return filemtime($a) - filemtime($b); } );
foreach($images as $image) {
$title = str_replace("_", " ", $image);
$title = str_replace("i/", "", $title);
$title = str_replace("src/", "", $title);
$title = str_replace(".png", "", $title);
$title = str_replace(".jpg", "", $title);
$title = str_replace(".JPG", "", $title);

42
rss.php Normal file
View File

@ -0,0 +1,42 @@
<?php
$url = 'https://data.bellz.org/l/i/gidderoni/';
?>
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>p-view/title>
<link><?php echo $url; ?></link>
<description>a tiny php script to automagically display photos</description>
<?php
$images = glob("src/*.{png,jpg,JPG}", GLOB_BRACE);
usort( $images, function( $b, $a ) { return filemtime($a) - filemtime($b); } );
foreach($images as $image) {
$title = str_replace("_", " ", $image);
$title = str_replace("src/", "", $title);
$title = str_replace(".png", "", $title);
$title = str_replace(".jpg", "", $title);
$title = str_replace(".JPG", "", $title);
$anchor = str_replace(" ", "", $title);
?>
<item>
<title><?php echo $title; ?></title>
<link><?php echo $url . '#' . $anchor;?></link>
<description><?php echo $url . $image; ?></description>
</item>
<?php
}
?>
</channel>
</rss>