#Be sure to change %FTP_USERNAME and PASWORD to match yours in the curl command args below

#File that will be created. Must match partypi picstat.sh
FILE="/home/pi/bin/picupweb/picson"
DATE=$(date +"%Y-%m-%d_%H%M")
# check for file.. if missing, uploads turned off
if [ -f $FILE ];
then
echo "Processing Images"
#--- Use Pi Camera
raspistill -o /home/pi/webcm/$DATE.png -w 1024 -h 768
#--- Use USB Camera
#fswebcam -r 1024x768 --no-banner /home/pi/webcm/$DATE.png

#ftp file from path where you store your images above
curl -T /home/pi/webcm/$DATE.png ftp://247coding.com/$DATE.png --user %FTP_USERNAME%:%FTP_PASSWORD%

#copy the current status image to the where the cmd.html points to for status
cp /home/pi/bin/relay/relayweb/static/picon.png /home/pi/bin/relay/relayweb/static/picstat.png
else
echo "Photo Uploads Disabled"
cp /home/pi/bin/relay/relayweb/static/picoff.png /home/pi/bin/relay/relayweb/static/picstat.png
fi

