First.
I'm trying to run .py script. With PHP it seems that the exec() would be best, but I can't get it to work. I have tried,
Code: Select all
<?php exec('sudo python /var/www/takepic.py'); ?>
Second.
I'm trying to load the latest picture that was taken in the /picture/ folder, they are named by the date that they where taken. And then have a next/prev/numbers button to brows them (I later found that the best way to do this would be by using jQuery, but need to read up on how to use it). But I was able to write this,
Code: Select all
<?php
$images = glob('*.{jpg,jpeg}', GLOB_BRACE);
$num_of_files = 1;
foreach($images as $image)
{
$num_of_files--;
if($num_of_files > -1)
echo "<b>".$image."</b><br>Created on ".date('D, d M y H:i:s', filemtime($image)) ."<br><img src="."'".$image."'"."><br><br>" ;
else
break;
}
?>
I also wrote this,
Code: Select all
<body class="left-sidebar">
<div id="wrapper">
<div id="content">
<div id="content-inner">
<div class="pager">
<div class="pages">
<a href="#" class="active">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
<span>…</span>
<a href="#">20</a>
</div>
<a href="#" class="button next">Next Page</a>
</div>
<article class="is-post is-post-excerpt">
</article>
</div>
</div>