View Single Post
Old 03-27-2015, 05:16 PM  
Barry-xlovecam
It's 42
 
Industry Role:
Join Date: Jun 2010
Location: Global
Posts: 18,083
Code:
#!/bin/bash
#imgct.sh
#FTP and CHMOD 755

find . -name "*.jpg" -or -name "*.gif" -or -name "*.png" | wc -l >ct.txt

exit
The bash script should start in the parent folder of the images -- it will recurse the sub directories from there.

You may have to path the PHP script to the ct.txt file.
crontab
there shold be access in the admin interface (cPanel?)
Quote:
*/10 * * * * /home/user/path/../../imgct.sh
#every 10 min
#30 18 * * *
#each day at 6:30 PM^
Crontab ? Quick Reference | Admin's Choice - Choice of Unix and Linux administrators

PHP Code:
<?php
//display count
//displayct.php
$imgct fopen("ct.txt""r") or die("Unable to open file!");
echo 
fread($imgctfilesize("ct.txt"));
fclose($imgct);
?>
You could make this PHP an include in the file you want it in. Path shown is relative to the .sh You will need to change the path from the template page or PHP file it is put on.

Freeware: MIT license as-is without warranty or guarantee.
Barry-xlovecam is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote