My DSLR-webcam is currently mounted on the southside of a roof.
At the moment germany is facing a strong heat-period.
So it's quite interesting to check the CPU-temp of the RaspberryPi.
You can do this by executing the following shell command:
vcgencmd measure_temp
In my case the output was today:
temp = 67.0'C
The datasheet of the CPU and also of the SD-card says that these parts have a 'operating temperature' of -25 to +85 °C.
Everything OK here.
Just the EOS1100D operation is out of range:
Canon limits the official 'working temperature range' to 0-40°C
DSLR Webcam with Raspberry Pi
DSLR camera as webcam and for timelapse shots with raspberry pi, gphoto2 and imagemagick
Sonntag, 5. Juli 2015
Sonntag, 28. Juni 2015
Issues with ISP DNS and no-ip.org URL
The ftp upload of the images showed some problems in these days:
The DNS information for the dyndns-url of no-ip.org was not correct.
During my tests I have seen, that the only way to get rid of the wrong DNS IP's is to overwrite the dynamic DNS-information in the raspberrypi, which was automatically set by DHCP IP-adress-retrieval.
The re-write for the DNS-adress can be done in /etc/resolv.conf
BUT: the DNS-information will be automatically overwritten at each DHCP-renewal or reboot of the raspberrypi.
Solution:
I created a small shell-script, which does the following:
- create a copy of the resolv.conf, without the "nameserver" information
- add the nameserver 8.8.8.8 to resolv.conf
- replace the original resolv.conf with the modified one
#!/bin/bash
cat /etc/resolv.conf | grep -v nameserver > /etc/resolv.conf.new
echo "nameserver 8.8.8.8" >> /etc/resolv.conf.new
mv /etc/resolv.conf.new /etc/resolv.conf
The DNS information for the dyndns-url of no-ip.org was not correct.
During my tests I have seen, that the only way to get rid of the wrong DNS IP's is to overwrite the dynamic DNS-information in the raspberrypi, which was automatically set by DHCP IP-adress-retrieval.
The re-write for the DNS-adress can be done in /etc/resolv.conf
BUT: the DNS-information will be automatically overwritten at each DHCP-renewal or reboot of the raspberrypi.
Solution:
I created a small shell-script, which does the following:
- create a copy of the resolv.conf, without the "nameserver" information
- add the nameserver 8.8.8.8 to resolv.conf
- replace the original resolv.conf with the modified one
#!/bin/bash
cat /etc/resolv.conf | grep -v nameserver > /etc/resolv.conf.new
echo "nameserver 8.8.8.8" >> /etc/resolv.conf.new
mv /etc/resolv.conf.new /etc/resolv.conf
This script will be executed now, before the ftp-upload starts.
Dienstag, 11. November 2014
Get Extermal WAN IP adress with command line
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
Montag, 10. November 2014
Temperature sensor DS18S20 and RaspberryPi
The DS18S20 is an integrated circuit, which is 1wire compatible.
$ sudo modbrobe w1-gpio pullup=1
It can be connected to the raspi as followed:
DS18S20 Pin1 (GND) --> Raspi P1-06 (Ground)
DS18S20 Pin2 (DATA) --> Raspi P1-07 (GPIO4)
DS18S20 Pin3 (VCC) --> Raspi P1-01 (3,3V)
Additionally we have to add a 4K7 resistor between DS18S20 Pin2 and Pin3
Once you have connected everything you can power up the raspi.
Raspbian comes with almost everything you need to read the temperature from DS18S20
DS18S20 Pin1 (GND) --> Raspi P1-06 (Ground)
DS18S20 Pin2 (DATA) --> Raspi P1-07 (GPIO4)
DS18S20 Pin3 (VCC) --> Raspi P1-01 (3,3V)
Additionally we have to add a 4K7 resistor between DS18S20 Pin2 and Pin3
Once you have connected everything you can power up the raspi.
Raspbian comes with almost everything you need to read the temperature from DS18S20
We have to start now the 1wire modules on raspberry:
$ sudo modbrobe w1-gpio pullup=1
$ sudo modprobe w1-therm
Attention! After the next reboot these modules will be not active.
If you want the modules to be started at each reboot, you have to add them to /etc/modules:
$ sudo nano /ect/modules
(add the follwoing lines:)
w1-gpio pullup=1
w1-therm
a quick check for current loaded modules can be done with:
$ lsmod -l
If everything is wired correctly and the modules were started, you can check the sensor by reading it's ID:
$ cat /sys/bus/w1/devices/w1_bus_master/w1_master_slaves
28-00080293af31
The sensors temperature data can be quickly checked by:
$ cat/sys/bus/w1/devices/28-00080293af31/w1-slave
2b 00 4b 46 ff ff 06 10 b1 : grc=b1 YES
2b 00 4b 46 ff ff 06 10 b1 : t=17375
't' has to be devided by 1000 to get the correct temp value - here 17,375 °C
good links for more details:
(en) http://www.raspberrypi-spy.co.uk/2013/03/raspberry-pi-1-wire-digital-thermometer-sensor/
(de) http://kampis-elektroecke.de/?page_id=3678
Attention! After the next reboot these modules will be not active.
If you want the modules to be started at each reboot, you have to add them to /etc/modules:
$ sudo nano /ect/modules
(add the follwoing lines:)
w1-gpio pullup=1
w1-therm
a quick check for current loaded modules can be done with:
$ lsmod -l
If everything is wired correctly and the modules were started, you can check the sensor by reading it's ID:
$ cat /sys/bus/w1/devices/w1_bus_master/w1_master_slaves
28-00080293af31
The sensors temperature data can be quickly checked by:
$ cat/sys/bus/w1/devices/28-00080293af31/w1-slave
2b 00 4b 46 ff ff 06 10 b1 : grc=b1 YES
2b 00 4b 46 ff ff 06 10 b1 : t=17375
't' has to be devided by 1000 to get the correct temp value - here 17,375 °C
good links for more details:
(en) http://www.raspberrypi-spy.co.uk/2013/03/raspberry-pi-1-wire-digital-thermometer-sensor/
(de) http://kampis-elektroecke.de/?page_id=3678
Montag, 15. September 2014
Hardware photos: DSLR housing, equipped with RasPi, PowerBoard and PoE splitter
The DSLR is now mounted in a waterproof housing.
Together with Raspberry Pi, selfmade PowerBoard (see earlier posts), PoE splitter.
It runs now temporarily in my backyard.
Lets see whether it runs stable and also remains dry in rainy wheather.
Now a few photos...
Freitag, 12. September 2014
install gphoto2 version 2.5.5 on raspberry pi
easiest way is to use the install script from:
https://github.com/gonzalo/gphoto2-updater/blob/master/gphoto2-updater.sh
https://github.com/gonzalo/gphoto2-updater/blob/master/gphoto2-updater.sh
#/bin/sh
# Gphoto2 2.5.5 compiler and installer script v0.3.1
#
# This script is specifically created for Raspbian http://www.raspbian.org
# and Raspberry Pi http://www.raspberrypi.org but should work over any
# Debian-based distribution
# Created and mantained by Gonzalo Cao Cabeza de Vaca
# Please send any feedback or comments to gonzalo.cao(at)gmail.com
# Updated for gPhoto2 2.5.1.1 by Peter Hinson
# Updated for gPhoto2 2.5.2 by Dmitri Popov
# Updated for gphoto2 2.5.5 by Mihai Doarna
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [ "$(whoami)" != "root" ]; then
echo "Sorry, this script must be executed with sudo or as root"
exit 1
fi
echo
echo "----------------"
echo "Updating sources"
echo "----------------"
echo
apt-get update
echo
echo "--------------------------"
echo "Removing gphoto2 if exists"
echo "--------------------------"
echo
apt-get remove -y gphoto2
echo
echo "-----------------------"
echo "Installing dependencies"
echo "-----------------------"
echo
apt-get install -y libltdl-dev libusb-dev libexif-dev libpopt-dev libudev-dev
echo
echo "-------------------------"
echo "Creating temporary folder"
echo "-------------------------"
echo
mkdir gphoto2-temp-folder
cd gphoto2-temp-folder
echo "gphoto2-temp-folder created"
echo
echo "-------------------------"
echo "Downloading libusb 1.0.17"
echo "-------------------------"
echo
if wget -q http://ftp.de.debian.org/debian/pool/main/libu/libusbx/libusbx_1.0.17.orig.tar.bz2
then
tar xjvf libusbx_1.0.17.orig.tar.bz2
cd libusbx-1.0.17/
else
echo "Unable to get libusbx_1.0.17"
echo "Cleaning and exiting..."
exit 1
fi
echo
echo "--------------------------------------"
echo "Compiling and installing libusb 1.0.17"
echo "--------------------------------------"
./configure
make
make install
cd ..
echo
echo "----------------------------"
echo "Downloading libgphoto2 2.5.5"
echo "----------------------------"
echo
if wget -q http://downloads.sourceforge.net/project/gphoto/libgphoto/2.5.5/libgphoto2-2.5.5.tar.bz2
then
tar xjf libgphoto2-2.5.5.tar.bz2
cd libgphoto2-2.5.5
else
echo "Unable to get libgphoto2-2.5.5"
echo "Cleaning and exiting..."
exit 1
fi
echo
echo "-----------------------------------------"
echo "Compiling and installing libgphoto2 2.5.5"
echo "-----------------------------------------"
echo
./configure
make
make install
cd ..
echo
echo "-------------------------"
echo "Downloading gphoto2 2.5.5"
echo "-------------------------"
echo
if wget -q http://downloads.sourceforge.net/project/gphoto/gphoto/2.5.5/gphoto2-2.5.5.tar.gz
then
tar xzvf gphoto2-2.5.5.tar.gz
cd gphoto2-2.5.5
else
echo "Unable to get gphoto2-2.5.5"
echo "Cleaning and exiting..."
exit 1
fi
echo
echo "--------------------------------"
echo "Compiling and installing gphoto2"
echo "--------------------------------"
echo
./configure
make
make install
cd ..
echo
echo "-----------------"
echo "Linking libraries"
echo "-----------------"
echo
ldconfig
echo
echo "-----------------------------------------------------------------------------------------------"
echo "Setting up permissions for USB ports, see http://www.gphoto.org/doc/manual/permissions-usb.html"
echo "-----------------------------------------------------------------------------------------------"
echo
/usr/local/lib/libgphoto2/print-camera-list udev-rules version 0.98 group plugdev mode 0660 > /etc/udev/rules.d/90-libgphoto2.rules
echo
echo "-------------------"
echo "Removing temp files"
echo "-------------------"
echo
cd ..
rm -r gphoto2-temp-folder
echo
echo "--------------------"
echo "Finished!! Enjoy it!"
echo "--------------------"
echo
gphoto2 --version
Donnerstag, 11. September 2014
script improvements: correct naming for captured images
for the webcam gallery the images shall be tagged with a naming convetion like hhmm_xx.jpg
xx varinats are:
hu = huge (original size, for klick&zoom-view in gallery)
la = large (smaller size, for direct view in gallery)
sm = small (small size, for thumbnail view in gallery)
And the photos shall be captured each 10 minutes.
The images shall have straight minute format.
And last but not least the images shall be placed in a directory-structure like /year/month/day/
Example: the image has been shot at 15:36h. DSCF2345.jpg was downloaded form the cam, and renamed by gphoto2 to webcam.jpg.
Then by imagemagick-command 'convert' the following images will be created:
1500_hu.jpg (original)
1500_la.jpg (reduced size 50% from original)
1500_sm.jpg (reduced size 20% from original)
All 3 photos will be uploaded by FTP in the correct folder.
The date-meta-data of the original photo 'webcam.jpg' has been taken into account to create the correct directory, and place the photos correctly.
The whole shell-script with the actual improvements:
#!/bin/bash
host='HOSTNAME'
USER='USERNAME'
PASS='PASSWORD'
rm *.jpg
while true
do
/usr/bin/gphoto2 --capture-image-and-download --filename "webcam.jpg"
imgname="webcam.jpg"
year=`date --reference $imgname +%Y`
month=`date --reference $imgname +%m`
day=`date --reference $imgname +%d`
hour=`date --reference $imgname +%H`
minute=`date --reference $imgname +%M`
mom=`date --reference $imgname +%H`
min=`date --reference $imgname +%M`
# show only full 10min
let min=$min/10*10
[ "$min" = "0" ] && min="00"
mom="${mom}$min"
mv $imgname $mom"_hu".jpg
convert $mom"_hu".jpg -resize 20% $mom"_sm".jpg
convert $mom"_hu".jpg -resize 50% $mom"_la".jpg
ftp -n -v $host <<EOT
ascii
user $USER $PASS
prompt
mkdir /webcamgallerydir/$year
mkdir /webcamgallerydir/$year/$month
mkdir /webcamgallerydir/$year/$month/$day
cd /webcamgallerydir/$year/$month/$day
put $mom"_hu".jpg
put $mom"_la".jpg
put $mom"_sm".jpg
bye
EOT
rm *.jpg
echo wait 10 minutes
sleep 600
done
xx varinats are:
hu = huge (original size, for klick&zoom-view in gallery)
la = large (smaller size, for direct view in gallery)
sm = small (small size, for thumbnail view in gallery)
And the photos shall be captured each 10 minutes.
The images shall have straight minute format.
And last but not least the images shall be placed in a directory-structure like /year/month/day/
Example: the image has been shot at 15:36h. DSCF2345.jpg was downloaded form the cam, and renamed by gphoto2 to webcam.jpg.
Then by imagemagick-command 'convert' the following images will be created:
1500_hu.jpg (original)
1500_la.jpg (reduced size 50% from original)
1500_sm.jpg (reduced size 20% from original)
All 3 photos will be uploaded by FTP in the correct folder.
The date-meta-data of the original photo 'webcam.jpg' has been taken into account to create the correct directory, and place the photos correctly.
The whole shell-script with the actual improvements:
#!/bin/bash
host='HOSTNAME'
USER='USERNAME'
PASS='PASSWORD'
rm *.jpg
while true
do
/usr/bin/gphoto2 --capture-image-and-download --filename "webcam.jpg"
imgname="webcam.jpg"
year=`date --reference $imgname +%Y`
month=`date --reference $imgname +%m`
day=`date --reference $imgname +%d`
hour=`date --reference $imgname +%H`
minute=`date --reference $imgname +%M`
mom=`date --reference $imgname +%H`
min=`date --reference $imgname +%M`
# show only full 10min
let min=$min/10*10
[ "$min" = "0" ] && min="00"
mom="${mom}$min"
mv $imgname $mom"_hu".jpg
convert $mom"_hu".jpg -resize 20% $mom"_sm".jpg
convert $mom"_hu".jpg -resize 50% $mom"_la".jpg
ftp -n -v $host <<EOT
ascii
user $USER $PASS
prompt
mkdir /webcamgallerydir/$year
mkdir /webcamgallerydir/$year/$month
mkdir /webcamgallerydir/$year/$month/$day
cd /webcamgallerydir/$year/$month/$day
put $mom"_hu".jpg
put $mom"_la".jpg
put $mom"_sm".jpg
bye
EOT
rm *.jpg
echo wait 10 minutes
sleep 600
done
download file from a server using ssh
A file can be downloaded from a server remotely by using the 'scp'-command as followed:
scp username@remotehost.tld:/remotedirectory/remotefile.txt /localdirectory
Example:
> scp bart@simpson.dyndns.com:/home/homer/marge.jpg /home/bart
open ssh connection on different port
ssh connections normally get opened on port 22.
In some cases the ssh port has been changed.
To get access from by shell command on different port, use -p and the port number.
Example:
> ssh 192.168.1.150 -p 2323
In some cases the ssh port has been changed.
To get access from by shell command on different port, use -p and the port number.
Example:
> ssh 192.168.1.150 -p 2323
Donnerstag, 28. August 2014
DSLR freeze - cam reset implemented
In some rare cases the DSLR freezes.
In this situation a power reset of the DSLR was the only way, to get it back to normal operation.
Due to the fact that the cam will be mounted on the roof of a house, the option of a remote-power-reset is desirable.
In this situation a power reset of the DSLR was the only way, to get it back to normal operation.
Due to the fact that the cam will be mounted on the roof of a house, the option of a remote-power-reset is desirable.
The idea was to switch a relay by one of the GPIO-ports of Raspi, remotely controlled via web-frontend.
Bash script 'camera_reset.sh':
#!/bin/bash
gpio mode 7 out
sleep 2
gpio write 7 1
sleep 3
gpio write 7 0
sleep 2
gpio mode 7 in
gpio mode 7 out
sleep 2
gpio write 7 1
sleep 3
gpio write 7 0
sleep 2
gpio mode 7 in
The "sleep" delays between the commands were necessary, to create a stable situation during command execution.
If the commands were executed without the delays, in some cases the commands were not executed properly or the RASPI freezes.
If the commands were executed without the delays, in some cases the commands were not executed properly or the RASPI freezes.
It was necessary, to use GPIO7 instead of GPIO16 or GPIO15, because GPIO16 and GPIO15 were immediately active during reboot of the raspi, and remained active - so the cam was not powered after a reboot of the raspi.
GPIO7 remains inactive (0) after reboot - so the cam is directly powered after reboot.
Also GPIO's 15 and 16 were not really stable.
In some cases the RASPI was freezed after switching GPIO15 or 16 as an OUT to 1 or 0.
Since I use GPIO7, I never experienced any freeze of the RASPI.
In some cases the RASPI was freezed after switching GPIO15 or 16 as an OUT to 1 or 0.
Since I use GPIO7, I never experienced any freeze of the RASPI.
GPIO numbering:
WiringPi GPIO7 = Raspi GPIO4 = Raspi Pin7
see here:
http://wiringpi.com/wp-content/uploads/2013/03/gpio1.png
WiringPi GPIO7 = Raspi GPIO4 = Raspi Pin7
see here:
http://wiringpi.com/wp-content/uploads/2013/03/gpio1.png
(howto's for script execution from a website, and the realized electrical circuit see earlier posts)
electrical part: raspi, poe splitter, camera, cam reset circuit (gpio)
as followed a few pictures, which show the electrical part of the outdoor timelapse cam
the wiring of the parts
(red cable is data and power input, white cable 7,5V for DSLR, black cable 5V for RaspberryPi)
circuit drawing, 7,5V output for DSLR with RaspberryPi controlled power reset, stabilized 5V output for RaspberryPi power
Sonntag, 24. August 2014
shell script automatic captures limited to specified daytime
if the shell script, which controls the automatic captures, shall be executed from 5:00h to 21:59h, do like this:
(daytime greater or equal 5:00h lower or equal 21:00h)
#!/bin/bash
host='YOURHOSTNAME'
USER='YOURUSERNAME'
PASS='YOURPASSWORD'
hour=`date +"%H"`
while [ $hour -ge 5 ] && [ $hour -le 21 ]
do
/usr/bin/gphoto2 --capture-image-and-download --filename
ftp -n -v $host <<EOT
ascii
user $USER $PASS
prompt
cd /array1/EigeneD/EigeneCaptures/
put *.JPG
bye
EOT
cp *.JPG /var/www/minigal/photos/last.JPG
rm *.JPG
echo warte 20 sek
sleep 20
done
(daytime greater or equal 5:00h lower or equal 21:00h)
#!/bin/bash
host='YOURHOSTNAME'
USER='YOURUSERNAME'
PASS='YOURPASSWORD'
hour=`date +"%H"`
while [ $hour -ge 5 ] && [ $hour -le 21 ]
do
/usr/bin/gphoto2 --capture-image-and-download --filename
ftp -n -v $host <<EOT
ascii
user $USER $PASS
prompt
cd /array1/EigeneD/EigeneCaptures/
put *.JPG
bye
EOT
cp *.JPG /var/www/minigal/photos/last.JPG
rm *.JPG
echo warte 20 sek
sleep 20
done
Freitag, 15. August 2014
start shell script daily at 5:00am
edit /etc/crontab:
# sudo nano /etc/crontab
add line:
0 5 * * * root /home/YOUR_USER/YOUR_SCRIPT
REMARK:
if you change anything in crontab, you have to restart cron:
# sudo /etc/init.d/cron restart
# sudo nano /etc/crontab
add line:
0 5 * * * root /home/YOUR_USER/YOUR_SCRIPT
REMARK:
if you change anything in crontab, you have to restart cron:
# sudo /etc/init.d/cron restart
Donnerstag, 14. August 2014
allow 'sudo' from browser for script
if you want to execute a script by browser input, you need to allow the webserver-user 'www-data' to use 'sudo' without the need to use sudo-password.
Therefore you use 'visudo' to edit /etc/sudoers, and add the follwing line at the end of the file:
www-data ALL=NOPASSWD: /home/YOUR_USER/YOUR_SCRIPT.sh
Therefore you use 'visudo' to edit /etc/sudoers, and add the follwing line at the end of the file:
www-data ALL=NOPASSWD: /home/YOUR_USER/YOUR_SCRIPT.sh
stop linux process from website with php
content for html-file:
<html>
<body>
<?php
if ($_GET['run']) {
# This code will run if ?run=true is set.
exec("sudo /home/pi/kill.sh", $output2);
}
?>
<!-- This link will add ?run=true to your URL, myfilename.php?run=true -->
<a href="?run=true"><img src="stop-button.png" width="200" 0height="160" border="0" alt="stop"></a>
</body>
</html>
content for shell script:
sudo killall capture_endless
<html>
<body>
<?php
if ($_GET['run']) {
# This code will run if ?run=true is set.
exec("sudo /home/pi/kill.sh", $output2);
}
?>
<!-- This link will add ?run=true to your URL, myfilename.php?run=true -->
<a href="?run=true"><img src="stop-button.png" width="200" 0height="160" border="0" alt="stop"></a>
</body>
</html>
content for shell script:
sudo killall capture_endless
start linux shell script from website with php
html code:
<html>
<body>
<?php
if ($_GET['run']) {
# This code will run if ?run=true is set.
exec("/home/YOUR_USER/YOUR_SCRIPT.sh", $output);
}
?>
<a href="?run=true">START</a>
</body>
</html>
<html>
<body>
<?php
if ($_GET['run']) {
# This code will run if ?run=true is set.
exec("/home/YOUR_USER/YOUR_SCRIPT.sh", $output);
}
?>
<a href="?run=true">START</a>
</body>
</html>
show linux process status on a website with php
html code:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<?php
exec("ps ax | grep PROCESS_NAME | grep -v grep 2>&1", $output, $ret);
?>
<table>
<tr>
<td align="undefined" valign="undefined">
<h2>
<?php if ($ret == "0") { echo "PROCESS IS RUNNING..."; } else {echo "PROCESS IS STOPPED"; } ?> </td>
</h2>
</tr>
</table>
</body>
</html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<?php
exec("ps ax | grep PROCESS_NAME | grep -v grep 2>&1", $output, $ret);
?>
<table>
<tr>
<td align="undefined" valign="undefined">
<h2>
<?php if ($ret == "0") { echo "PROCESS IS RUNNING..."; } else {echo "PROCESS IS STOPPED"; } ?> </td>
</h2>
</tr>
</table>
</body>
</html>
linux shell script for endless photo capture with gphoto2 and automatic ftp-upload
linux shell script sourcecode:
#!/bin/bash
host='YOUR_HOSTNAME'
USER='YOUR_USERNAME'
PASS='YOUR_PASSWORD'
counter=1
while true
do
/usr/bin/gphoto2 --capture-image-and-download --filename
ftp -n -v $host <<EOT
ascii
user $USER $PASS
prompt
cd /YOUR_FOLDER_ON_FTP_SERVER_WHERE_PHOTOS_SHALL_PLACED/
put *.JPG
bye
EOT
cp *.JPG /var/www/YOUR_WEBSERVER_FOLDER_WHERE_A_COPY_SHALL_PLACED/last.JPG
rm *.JPG
echo waiting 20 sec
sleep 20
done
#!/bin/bash
host='YOUR_HOSTNAME'
USER='YOUR_USERNAME'
PASS='YOUR_PASSWORD'
counter=1
while true
do
/usr/bin/gphoto2 --capture-image-and-download --filename
ftp -n -v $host <<EOT
ascii
user $USER $PASS
prompt
cd /YOUR_FOLDER_ON_FTP_SERVER_WHERE_PHOTOS_SHALL_PLACED/
put *.JPG
bye
EOT
cp *.JPG /var/www/YOUR_WEBSERVER_FOLDER_WHERE_A_COPY_SHALL_PLACED/last.JPG
rm *.JPG
echo waiting 20 sec
sleep 20
done
show datetime from JPG exif data with php
php-code:
<?php
$exif = exif_read_data('IMAGE.JPG', 'IFD0', 0);
$edate = $exif['DateTime'];
if (strlen($edate) > 0) echo "<h2>Date/Time $edate</h2>";
?>
$exif = exif_read_data('IMAGE.JPG', 'IFD0', 0);
$edate = $exif['DateTime'];
if (strlen($edate) > 0) echo "<h2>Date/Time $edate</h2>";
?>
read complete exif data from JPG with php
php-code:
<?php
echo "IMAGE.JPG:<br />\n";
$exif = exif_read_data('IMAGE.JPG', 'IFD0');
echo $exif===false ? "Keine Headerdaten gefunden.<br />\n" : "Bild beinhaltet Header<br />\n";
$exif = exif_read_data('IMAGE.JPG', 0, true);
echo "IMAGE.JPG:<br />\n";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
?>
<?php
echo "IMAGE.JPG:<br />\n";
$exif = exif_read_data('IMAGE.JPG', 'IFD0');
echo $exif===false ? "Keine Headerdaten gefunden.<br />\n" : "Bild beinhaltet Header<br />\n";
$exif = exif_read_data('IMAGE.JPG', 0, true);
echo "IMAGE.JPG:<br />\n";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
?>
Mittwoch, 13. August 2014
Abonnieren
Posts (Atom)