Simple PHP script to perform camera scanning

General discussion about software packages and releases, new software you've found, and threads by programmers and script writers.

Moderator: peterZ

Post Reply
stromateis
Posts: 8
Joined: 29 Oct 2014, 00:18
Number of books owned: 0
Country: USA

Simple PHP script to perform camera scanning

Post by stromateis »

As a participant in the Archivist Beta program, I developed a simple one webpage PHP script that works with CHDKPTP on a Linux server with Apache. It is designed to work with two cameras. It has some specifics designed into it for the Raspberry Pi Raspbian linux distribution, but should be easily modified to adjust to any other webserver and distribution.

I've fully commented the code, added the ability to setup the cameras with the proper odd and even config, zip up the files (all pictures, even pics, and odd pics in separate zip files) and a button to take you to the right directory to download. It makes use of a connected USB pedal to trigger the capture (as used in the Archivist Beta).

To implement on a Raspberry Pi Raspbian distro:

#install CHDKPTP
#Install the necessary apache, php, and zip packages
apt-get -y install apache2 apache2-doc apache2-utils libapache2-mod-php5 php5 php-pear php5-xcache zip

#add www-data user to group 'input' (to read the pedal push)
adduser www-data input

mkdir -p /var/www/scan (we save to the scan directory)
chown www-data:www-data /var/www/scan (allow apache to read and write files to)

#delete the default apache index.html
rm -f /var/www/index.html

cp index.php /var/www/index.php

Just point your browser to the raspberry pi and it should load the index.php page automatically.
Attachments
index.zip
Simple PHP file for performing a book scan with two cameras using CHDKPTP.
(6.33 KiB) Downloaded 475 times
stromateis
Posts: 8
Joined: 29 Oct 2014, 00:18
Number of books owned: 0
Country: USA

Re: Simple PHP script to perform camera scanning

Post by stromateis »

Updated script file with a few fixes
Attachments
index.zip
(6.37 KiB) Downloaded 436 times
stromateis
Posts: 8
Joined: 29 Oct 2014, 00:18
Number of books owned: 0
Country: USA

Re: Simple PHP script to perform camera scanning

Post by stromateis »

Just a few more fixes (found it's helpful to enter the alt menu, take a shot, then exit the alt menu to keep the PTP system steady and not timeout after a number of shots), but also an enhancement allowing for a more "parallel" capture (speeding things up a bit) and I added a beep letting the user know the system is ready for the next capture.
Attachments
indexv1.3.zip
(6.54 KiB) Downloaded 480 times
Post Reply