Photos Enhancements (#10)
* Skip files, only process albums. Do not open a new tab now that there is a BACK button. * Continue opening in new tab so that photos page does not need reloaded. * Fix CSS and make HTML readable.
This commit is contained in:
parent
adc8f29f0a
commit
8dd9ab1615
@ -12,24 +12,41 @@ cd `dirname $0`/..
|
||||
|
||||
# Create the necessary HTML components for a web page.
|
||||
$HELPER_DIR/body_open.php
|
||||
echo ""
|
||||
|
||||
# Give the page a description.
|
||||
echo -e "\n\t\t<h1 class='col-12 title'>Photo Albums</h1>"
|
||||
echo -en "\t\t<p class='col-12 text'>You may click on an album name to view "
|
||||
echo -en "all of its files, or click on a specific image to bring up the full "
|
||||
echo -en "resolution. On the album pages you may also click an image or video "
|
||||
echo -e "name to pull up the full resolution for download.</p>"
|
||||
echo -e "\t\t<div class='row'>"
|
||||
echo -e "\t\t\t<h1 class='col-12 title'>Photo Albums</h1>"
|
||||
echo -e "\t\t</div>"
|
||||
|
||||
echo -e "\t\t<div class='row'>"
|
||||
echo -e "\t\t\t<div class='col-12 text'>"
|
||||
echo -en "\t\t\t\t<p>You may click on an album name to "
|
||||
echo -en "view all of its files, or click on a specific image to bring up the "
|
||||
echo -en "full resolution. On the album pages you may also click an image or "
|
||||
echo -e "video name to pull up the full resolution for download.</p>"
|
||||
echo -e "\t\t\t</div>"
|
||||
echo -e "\t\t</div>"
|
||||
|
||||
# Display the album names descending.
|
||||
ls files/photos/ | sort -r | while read album; do
|
||||
# Skip files, only read directories.
|
||||
if [[ ! -d files/photos/$album ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Clean album name.
|
||||
album_name=${album}
|
||||
album_name=${album_name//_/ }
|
||||
album_name=${album_name//-/ }
|
||||
echo -en "\t\t<h2 class='col-12 title'>"
|
||||
echo -e "\t\t<div class='row'>"
|
||||
echo -en "\t\t\t<h2 class='col-12 title'>"
|
||||
echo -en "<a href='/files/photos/$album/index.html' "
|
||||
echo -e "target='_blank' rel='noopener noreferrer'>$album_name</a></h2>"
|
||||
echo -e "\t\t<div class='col-12 text'>"
|
||||
echo -e "\t\t</div>"
|
||||
|
||||
# Catch all the upcoming photo records.
|
||||
echo -e "\t\t<div class='row'>\n\t\t\t<div class='col-12 text'>"
|
||||
|
||||
# Create index page for each photo ALBUM based on its contents.
|
||||
page=""
|
||||
@ -37,11 +54,15 @@ ls files/photos/ | sort -r | while read album; do
|
||||
$HELPER_DIR/body_open.php > $subpage
|
||||
|
||||
# Add a back button
|
||||
echo -en "\n\t\t<a href='/photos'>" >> $subpage
|
||||
echo -e "<h3 class='col-12 title'>Back</h3></a>" >> $subpage
|
||||
echo -en "\n\t\t<div class='row'>\n\t\t\t<a href='/photos'>" >> $subpage
|
||||
echo -e "<h3 class='col-12 title'>Back</h3></a>\n\t\t</div>" >> $subpage
|
||||
|
||||
# Build the ALBUM page.
|
||||
echo -e "\t\t<h1 class='col-12 title'>$album_name</h1>" >> $subpage
|
||||
echo -e "\t\t<div class='row'>" >> $subpage
|
||||
echo -e "\t\t\t<h1 class='col-12 title'>$album_name</h1>" >> $subpage
|
||||
echo -e "\t\t</div>" >> $subpage
|
||||
|
||||
echo -e "\t\t<div class='row text'>" >> $subpage
|
||||
ls files/photos/$album/* | sort | while read photo; do
|
||||
# Do not include the index page.
|
||||
if [[ $photo == *"index.html" ]]; then
|
||||
@ -60,10 +81,10 @@ ls files/photos/ | sort -r | while read album; do
|
||||
|
||||
if [[ $photo == *"/README.md" || $photo == *"/README.txt" ]]; then
|
||||
# If there is a README, show it on the PHOTOS page without a link.
|
||||
echo -e "\t\t\t<p>`cat $photo`</p>"
|
||||
echo -e "\t\t\t\t<p>`cat $photo`</p>"
|
||||
else
|
||||
# Otherwise put in the PHOTOS page list.
|
||||
echo -en "\t\t\t<li class='indent'><a href=/$photo target='_blank' "
|
||||
echo -en "\t\t\t\t<li class='indent'><a href=/$photo target='_blank' "
|
||||
echo -en "rel='noopener noreferrer'>$filename"
|
||||
if [[ $photo == *".mp4" ]]; then
|
||||
echo -en " [VIDEO]"
|
||||
@ -72,34 +93,36 @@ ls files/photos/ | sort -r | while read album; do
|
||||
fi
|
||||
|
||||
# Put in the subpage HTML.
|
||||
echo -e "\t\t<div class='col-6 center'>" >> $subpage
|
||||
echo -en "\t\t\t<a href=/$photo target='_blank' " >> $subpage
|
||||
echo -e "\t\t\t<div class='col-6 center'>" >> $subpage
|
||||
echo -en "\t\t\t\t<a href=/$photo target='_blank' " >> $subpage
|
||||
echo -e "rel='noopener noreferrer'>" >> $subpage
|
||||
if [[ $photo == *".mp4" ]]; then
|
||||
echo -e "\t\t\t\t<video width='320px' controls>" >> $subpage
|
||||
echo -e "\t\t\t\t\t<source src='/$photo' type=video/mp4>" >> $subpage
|
||||
echo -e "\t\t\t\t\tYour browser does not support videos." >> $subpage
|
||||
echo -e "\t\t\t\t</video>" >> $subpage
|
||||
echo -e "\t\t\t\t\t<video width='320px' controls>" >> $subpage
|
||||
echo -e "\t\t\t\t\t\t<source src='/$photo' type=video/mp4>" >> $subpage
|
||||
echo -e "\t\t\t\t\t\tYour browser does not support videos." >> $subpage
|
||||
echo -e "\t\t\t\t\t</video>" >> $subpage
|
||||
elif [[ $photo == *".md" || $photo == *".txt" ]]; then
|
||||
echo -e "\t\t\t\t<p>`cat $photo`</p>" >> $subpage
|
||||
echo -e "\t\t\t\t\t<p>`cat $photo`</p>" >> $subpage
|
||||
else
|
||||
echo -e "\t\t\t\t<img src='/$photo'/>" >> $subpage
|
||||
echo -e "\t\t\t\t\t<img src='/$photo'/>" >> $subpage
|
||||
fi
|
||||
|
||||
# Add a descriptive link.
|
||||
echo -en "\t\t\t\t<p>$filename" >> $subpage
|
||||
echo -en "\t\t\t\t\t<p>$filename" >> $subpage
|
||||
if [[ $photo == *".mp4" ]]; then
|
||||
echo -en " [VIDEO]" >> $subpage
|
||||
fi
|
||||
echo -e "</p>\n\t\t\t</a>\n\t\t</div>" >> $subpage
|
||||
echo -e "</p>\n\t\t\t\t</a>\n\t\t\t</div>" >> $subpage
|
||||
done
|
||||
echo -e "\t\t</div>" >> $subpage
|
||||
|
||||
# End album on PHOTOS page.
|
||||
# End album listings on PHOTOS page.
|
||||
echo -e "\t\t\t</div>"
|
||||
echo -e "\t\t</div>"
|
||||
|
||||
# Add a final back button
|
||||
echo -en "\t\t<a href='/photos'>" >> $subpage
|
||||
echo -e "<h3 class='col-12 title'>Back</h3></a>" >> $subpage
|
||||
echo -en "\n\t\t<div class='row'>\n\t\t\t<a href='/photos'>" >> $subpage
|
||||
echo -e "<h3 class='col-12 title'>Back</h3></a>\n\t\t</div>" >> $subpage
|
||||
|
||||
# Close out the ALBUM's page.
|
||||
$HELPER_DIR/body_close.php >> $subpage
|
||||
|
Loading…
x
Reference in New Issue
Block a user