Motion - Feature Request 2013x 08x 19x 134513

Feature Request: simple motion.video gallery

Description

hi, thanks for such a great work.

well one of my tune-up was moving saved video directory into /www and i've made a simple gallery script

here's the index.php content

<php> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head>

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <meta http-equiv="expires" content="0"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="pragma" content="no-cache" /> <meta itemprop="name" content="Motion Detect"> <meta itemprop="description" content="WebCam Detect Motion">

<!-- this .gif should be transcoded to .ico just rename the png file or gif as well--> <link rel="shortcut icon" type="image/x-icon" href="http://www.lavrsen.dk/foswiki/pub/Motion/WebPreferences/motion-trans.gif" /> <title>Motion WebCam</title> <style type="text/css"> <!-- a:link { color: #8F30CF} a:visited { color: #0E4BB1 } a:active { color: #CCCC33}

body {
color
#009900;
background-color
#000000;
margin-left
10px;
margin-top
10px;
margin-bottom
10px;
text-align
left;
}

--> </style>

</head> <body>

<table width="90%" border="0" align="center"> <tr> <td> <br><ol id="gallery"> <H2>Motion Web Cam</H2> <h3></h3> <br> <br/> <? $dir = './'; $allowed_types=array('avi','jpg','jpeg'); $u =0; $dir_hand =@opendir($dir) or die("something curious about this broadcasting");

while ($fi = readdir($dir_hand)) { if($fi=='.' || $fi == '..') continue; $fi_pa = explode('.',$fi); $ext = strtolower(array_pop($fi_pa)); $title = implode('.',$fi_pa); $title = htmlspecialchars($title); if (in_array($ext,$allowed_types)) {

$fiea[]= $fi;

$u++; } } closedir($dir_hand);

reset($fiea); sort($fiea, SORT_NATURAL); $fiel = count($fiea);

for ($z=$fiel;$z>$fiel-77;$z--) { echo ' <a href="'.$fiea[$z].'"><img alt="'.$fiea[$z].'"src="'.$fiea[$z].'" width="600"/></a> <br>'.$fiea[$z].'<br><br>';

}

?>

</ol> </div> <br> <br> </tr> <tr> <td colspan="6" align="center">© </td> </tr> </table> </body> <?

i've removed few strings and backgrounds, but actually i can provide those too, just for a better site view - just my own site style just put this file into directory and this will get last 77 images+avi files as picture+url_video

-- AtumRA - 19 Aug 2013

Follow up

Comments

to get the whole directory file listing (that usually takes more time) i got the second file where the little change is for ($z=$fiel;$z>0;$z--) also few more extensions can be set

-- AtumRA - 19 Aug 2013

and here's the cron.weekly sh.scripty that moves files into folders to make it easier to display such gallery <script src="https://gist.github.com/oeai/6352491.js"></script>

-- AtumRA - 27 Aug 2013

oops, it's not embedding, so here's decode

========================================= #!/bin/sh

DateMonth=$(date +'%b') MotionPath="/var/motion/" DateWeek=$(date +'%W')

Mfolder=$MotionPath$DateMonth

create_dir_month() { mkdir $Mfolder }

if [ -d $Mfolder ]; then echo "Got $Mfolder directory";

else echo "Creating $Mfolder dir " create_dir_month fi

Wfolder=$Mfolder/$DateWeek create_dir_week() { mkdir $Wfolder }

copy_aj_files() { mv $MotionPath/*.avi -t $Wfolder mv $MotionPath/*.jpg -t $Wfolder cp $MotionPath/*.php -t $Wfolder }

if [ -d $Wfolder ]; then echo "Got $Wfolder directory";

else echo "Creating $Wfolder dir " create_dir_week fi copy_aj_files

DataStamp=$(eval date +%j) echo "day $DataStamp moved Motion files into subdir $Wfolder"

exit 0 ====================================

-- AtumRA - 27 Aug 2013

both codes are in gist https://gist.github.com/oeai/6299505 https://gist.github.com/oeai/6352491

-- AtumRA - 27 Aug 2013
Topic revision: r2 - 27 Aug 2013, AtumRA
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.