andreknieriem / photobooth

A photobooth Web-Application for raspberry pi with gphoto2
https://photobooth.andrerinas.de/
MIT License
300 stars 163 forks source link

Installation instructions for Windows #121

Closed andi34 closed 2 years ago

andi34 commented 5 years ago

Installation on Windows

Download needed files

Install & extract needed Software

Prepare Apache HTTP Server

Edit C:\Apache24\conf\httpd.conf using Notepad++
Find the following text (~ on line 284):

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

And change it to

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

To the end of the file add the following:

LoadModule php7_module "C:/php/php7apache2_4.dll"
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

PHPIniDir "C:/php"

Inside C:\Apache24\htdocs add a new file called info.php and add the following content:

<?php
phpinfo();
?>

Inside C:\Apache24 create a new file called cmd.bat and add th following content:

cd "C:\Apache24\bin"
cmd

Prepare PHP

Go to C:\php and rename the php.ini-production to php.ini.

Edit the php.ini using Notepad++ to enable the GD library:
Find ;extension=fileinfo and remove the ; in front of the line.
Find ;extension=gd2 and remove the ; in front of the line.
Find ;extension_dir = "ext" and remove the ; in front of the line and change it to extension_dir = "C:/php/ext"

Start Apache Server

Go to C:\Apache24 and right click on the cmd.bat, choose "Run as administrator":
To start the Webserver on boot automatically, type httpd.exe -k install.

Once that's done, lets start our webserver:
httpd.exe -k start

If you need to stop the webserver (e.g. if you like to change the php.ini):
httpd.exe -k stop

Test your Webserver & PHP

Open http://localhost/info.php in your Browser, you should see the PHP Information page.

Install Digicamcontrol

Install Digicamcontrol to C:\Apache24\htdocs\digicamcontrol\

Setup Photobooth

Remove all files inside C:\Apache24\htdocs\.
Next you need to extract the Photobooth Release-ZIP to C:\Apache24\htdocs\.

Open http://localhost/admin in your Browser and adjust your "take picture command" (inside the "Commands" section):
C:\Apache24\htdocs\digicamcontrol\CameraControlCmd.exe /capture /filename %s

Enjoy!

You should now be able to use Photobooth on your Windows machine!

lagrandeours commented 4 years ago

hello i try to make the install in a PC, but i'm more photographer than developper but i give a try and keep you inform

lagrandeours commented 4 years ago

hello on windows i added some simple html code and it work fine to take the picture i added it in the core js bc in admin not working ... $.post("http://localhost:5513/?slc=capture"

lagrandeours commented 4 years ago

and now how to get the pictures in the workflow ? bc in digicam i can send the pictures to data/temp or img but nothing happend ...

andi34 commented 4 years ago

It should work out of the box and download the picture inside the tmp folder and doing the post processing to have the picture in the img folder as result.

You only might need to adjust the take picture cmd via admin panel to match your setup: digicamcontrol\CameraControlCmd.exe /capture /filename %s

Make sure the path matches your setup. Maybe needs to be ..\digicamcontrol\CameraControlCmd.exe /capture /filename %s ?

lagrandeours commented 4 years ago

thank you so musch for your answear :-) yes great with double dot : ....\digiCamControl\CameraControlCmd.exe /capture /filename %s and sorry to ask you about to use a Printer in windows what is the command to replace mspaint /pt ?

andi34 commented 4 years ago

Quick search gave 2 things you can try to print (scroll down on both pages an read the answers): https://superuser.com/questions/1407593/how-to-print-using-cmd-only-with-the-name-of-the-printer

https://superuser.com/questions/1399939/how-to-print-image-file-in-windows7-using-command-line-lpr

andi34 commented 4 years ago

But mspaint /p %s should be enough.

Print an image from Paint directly through the
command line by adding a space after "mspaint"
and adding "/p" then a filename 
(e.g.: "mspaint /p c:/folder/subfolder/filename").
The command prints to your default printer.

Use "/pt" followed by the name of a printer to
print to a specific device.
lagrandeours commented 4 years ago

ok thanks a lot may be %s was missing :-) but in fact it print only if i press the print button after taking a picture in the gallery the print button not working may be a little bug ?

for the command to take the photo it s better to use Remote ....\digiCamControl\CameraControlRemoteCmd.exe /c capture %s with digicam running in background it take the photo quickly (with cmd it take time to connect to the camera for each picture)

thanks a LOOOOOOOOOOOOOOOOOOOOOT

this photobooth is my new project and with your app it s working just PERFECT !!!

realy thanks how can i offer you a good Café :-)

andi34 commented 4 years ago

ok thanks a lot may be %s was missing :-) but in fact it print only if i press the print button after taking a picture in the gallery the print button not working may be a little bug ?

Anything visible in the console log of your browser why it fails? (Press F12 to access it)

for the command to take the photo it s better to use Remote ....\digiCamControl\CameraControlRemoteCmd.exe /c capture %s with digicam running in background it take the photo quickly (with cmd it take time to connect to the camera for each picture)

thanks a LOOOOOOOOOOOOOOOOOOOOOT

Thanks a lot for the info :+1: I'll try to setup on a Windows and play around myself for proper documentation of the installation instructions once I've more time.

this photobooth is my new project and with your app it s working just PERFECT !!!

realy thanks how can i offer you a good Café :-)

No need, but if you like you can find a donation link in my fork https://github.com/andi34/photobooth or GitHub Userpage http://andi34.github.io/donations.html

lagrandeours commented 4 years ago

http://localhost/photobooth-2.1.0/api/print.php?filename=images%5C20200223_182303.jpg

there is %5C in the code ....

andi34 commented 4 years ago

5C is the hex code for '\' (backward slash). I let you know if I've an idea how to solve it. Might be a windows specific issue.

andi34 commented 4 years ago

Does the Download link work? Does Chromakeying link work? QR from Gallery points to the right URL? Does print work from Chromakeying? Tried a different browser?

lagrandeours commented 4 years ago

ok but when i send print command juste after taking the picture it work fine :-) this problem apear only from the gallery

lagrandeours commented 4 years ago

juste see your reply i check this

andi34 commented 4 years ago

Just mobile and can't test. Maybe you have time and can give feedback. Please test https://github.com/andi34/photobooth/commit/04f94a8b20ccbdd3357ed0af661c10145caba778

lagrandeours commented 4 years ago

Hi :) so in dowload.php

echo file_get_contents(DIR.'/../data/images/'.$image);

Does the Download link work? no there is /../ and double /images folder ...

no Warning: file_get_contents(C:\xampp2\htdocs\photobooth-2.1.0\api/../data/images/images\20200224_174845.jpg): failed to open stream: No such file or directory in C:\xampp2\htdocs\photobooth-2.1.0\api\download.php on line 7

Does Chromakeying link work? yes QR from Gallery points to the right URL? no Does print work from Chromakeying? yes it send to printer but seem to stuck after printing Tried a different browser? the same

andi34 commented 4 years ago

You've tried the code change posted above?

lagrandeours commented 4 years ago

i m trying this and the download work fine but ...

echo file_get_contents(dirname(__DIR__,1).'/'.$image);
// echo file_get_contents(__DIR__.'/../data/images/'.$image);
lagrandeours commented 4 years ago

... qr code and print not ...

lagrandeours commented 4 years ago

You've tried the code change posted above?

yes same pb

lagrandeours commented 4 years ago

may be in the print file this line 53

$url = 'http://'.$SERVER_IP.'/api/download.php?image='; QRcode::png($url.$filename, $filename_codes, QR_ECLEVEL_H, 10);

not good as my installation is in http://localhost/photobooth-2.1.0/

lagrandeours commented 4 years ago

now it s ok the installation have to be in localhost direct

lagrandeours commented 4 years ago

now i have to manage the printing issues with command line : print size / resize the pict etc ... i m trying with IrfanView 64 to manage différent settings ... I m so close :-)

andi34 commented 4 years ago

now it s ok the installation have to be in localhost direct

Does it also work without my change now? Path should be without - it . There's an option "crop on print" In admin panel.

lagrandeours commented 4 years ago

Does it also work without my change now? NO not working ... keep the change :-)

Path should be without - it . ok ... ?

There's an option "crop on print" In admin panel. ok thanks

andi34 commented 4 years ago

Path should be without - it . ok ... ?

Can be a subfolder too like:

photobooth
photobooth210

Also I'd avoid whitespaces like photobooth 210

lagrandeours commented 4 years ago

About the QRCode the download process not working directly from android i have to copy past the "text" in the browser it s due to the str_replace('\','/',$filename) ... QrCode.php QRcode::png($url.str_replace('\','/',$filename), false, QR_ECLEVEL_H, 10);

andi34 commented 4 years ago

There must be an issue on your end with that, it's not getting the filename right. Double check if you've applied my changes correctly for the /\ replacement.

https://github.com/andreknieriem/photobooth/blob/master/api/qrcode.php

lagrandeours commented 4 years ago

Path should be without - it . ok ... ?

Can be a subfolder too like:

photobooth
photobooth210

Also I'd avoid whitespaces like photobooth 210

about the app in subfolder it's not working at all ...

andi34 commented 4 years ago

Path should be without - it . ok ... ?

Can be a subfolder too like:

photobooth
photobooth210

Also I'd avoid whitespaces like photobooth 210

about the app in subfolder it's not working at all ...

If it's inside a folder "photobooth" you'll have to access it via localhost/photobooth. I don't see a reason why this shouldn't work on windows.

lagrandeours commented 4 years ago

do you have time to come on my pc with remote chrome access ?

andi34 commented 4 years ago

do you have time to come on my pc with remote chrome access ?

Not today, maybe next days.

You can write a mail to me and I'll give you a Photobooth zip you can test.

moritzb57 commented 4 years ago

hello, i can't find the digiCamControl.zip file which i need to connect to the camera. can someone send me a link or something like that? thanks

andi34 commented 4 years ago

hello, i can't find the digiCamControl.zip file which i need to connect to the camera. can someone send me a link or something like that? thanks

Mentioned inside the README.md ;) http://digicamcontrol.com/

moritzb57 commented 4 years ago

Thank you, I've already read that, but I can only find .exe files and a .zip file in the alpha version which results an error message when taking a photo. image

andi34 commented 4 years ago

You've adjusted the take picture command?

andi34 commented 4 years ago

Install inside a subfolder, called "digicamcontrol", of your Photobooth folder.

Take picture command should by default be:

digicamcontrol\CameraControlCmd.exe /capture /filename %s

If it's not working make sure real error messages are enabled inside admin panel, press F12 once an error shows up and tell what's mentioned in the browser console

atilavilela commented 4 years ago

I have this same problem @memberbro This is the error message that appears to me: {error: "Gphoto returned with an error code", cmd: "digicamcontrol\CameraControlCmd.exe /capture /file…oth\data\tmp\1433bab09412343e0094a9fb551a8fc2.jpg", returnValue: 1, output: Array(0)} cmd: "digicamcontrol\CameraControlCmd.exe /capture /filename C:\xampp\htdocs\photobooth\data\tmp\1433bab09412343e0094a9fb551a8fc2.jpg" error: "Gphoto returned with an error code"

andi34 commented 4 years ago

Make sure the path exist

C:\xampp\htdocs\photobooth\digicamcontrol\ with the CameraControlCmd.exe inside.

Maybe try \\digicamcontrol\\CameraControlCmd.exe /capture /filename %s

andi34 commented 4 years ago

Another thing might be that there's some other changes needed not included here atm.

https://github.com/andi34/photobooth/commit/629d8df9ec93a0447931745982a44743a6412153

https://github.com/andi34/photobooth/commit/233ca56272ee456ac2e7358ff658d6385ce3c908

https://github.com/andi34/photobooth/commit/83adf3fdb0b35991e7267bea35bfb57b3e088d81

https://github.com/andi34/photobooth/commit/6e66882c1f56d664633ace7c22ea6e5509aebafe

https://github.com/andi34/photobooth/commit/55651c20e707ddb31b465e1b57d0922d59a9b584

atilavilela commented 4 years ago

I did the whole process and confirmed that CameraControlCmd.exe is not in the correct location, but unfortunately it did not execute the file. I tried to run the command / capture / filename% s directly in the .exe but I also did not succeed

andi34 commented 4 years ago

%s is the path and filename, you'll have to type something like /filename test.jpg if you test it via console.

This issue is about creating instructions for Windows as there's no proper documentation. If you have success please let me know.

atilavilela commented 4 years ago

@andi34 unsuccessful with the command manual. I intend to buy a raspbarry pi3 + the installation of the system in it is simpler than in windows?

andi34 commented 4 years ago

Your camera is supported by Digicamcontrol? http://digicamcontrol.com/cameras

If not, a Pi only will make a difference if your camera is supported by gphoto2. http://gphoto.org/proj/libgphoto2/support.php

atilavilela commented 4 years ago

I have a canon sl2, when I run through the application it works normally but the commands do not work. can it be compatible with my computer? older motherboard and processor .... I can perform all functions if I start digicamcontrol, but at the prompt it interrupts the process image

andi34 commented 4 years ago

Here's my setup:

Download needed files

Install needed Software

Prepare Apache2

Edit C:\Apache24\conf\httpd.conf using Notepad++
Find the following text (~ on line 284):

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

And change it to

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

To the end of the file add the following:

LoadModule php7_module "C:/php/php7apache2_4.dll"
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

PHPIniDir "C:/php"

Inside C:\Apache24\htdocs add a new file called info.php and add the following content:

<?php
phpinfo();
?>

Inside C:\Apache24 create a new file called cmd.bat and add th following content:

cd "C:\Apache24\bin"
cmd

Prepare PHP

Go to C:\php and create a copy of the php.ini-production and rename it to php.ini

Edit the php.ini using Notepad++ to enable the GD Library:
Find ;extension=gd2 and remove the ; in front of the line.
Find ;extension_dir = "ext" and remove the ; in front of the line and change it to extension_dir = "C:/php/ext"

Start Apache Server

Go to C:\Apache24 and right click on the cmd.bat, choose "Run as administrator".
Type httpd.exe -k install to start the Webserver on boot automatically.

Once that's done, lets start our webserver:
httpd.exe -k start

If you need to stop the webserver (e.g. if you like to change the php.ini):
httpd.exe -k stop

Test your Webserver & PHP

Open http://localhost/info.php in your Browser, you should see the PHP Information page.

Install Digicamcontrol

Install Digicamcontrol to C:\Apache24\htdocs\digicamcontrol\

Setup Photobooth

Remove all files inside C:\Apache24\htdocs\ Extract the Photobooth ZIP to C:\Apache24\htdocs\

Open http://localhost/admin in your Browser.

Adjust your take picture command:
C:\Apache24\htdocs\digicamcontrol\CameraControlCmd.exe /capture /filename %s

andi34 commented 4 years ago

Not sure what I am missing or what could be wrong on the applyEffects.php...

Anyone an idea?

andi34 commented 4 years ago

Even after the PC was turned off it wasn't working. I've stopped the Apache Server via httpd.exe -k stop, waited a minute and started it again httpd.exe -k start and its working now. Crazy... I've now also put the full path to the php extensions as the GD library wasn't loaded properly.

andi34 commented 4 years ago

@atilavilela I've updated the first post with my instructions. Could you please test if it also works for you?

andi34 commented 2 years ago

https://photoboothproject.github.io/Installation-on-Windows