Sharing photos on Raspberry Pi with Lychee

Warning : This article has been automatically translated by Bing Translate

If you want to store your photos at home and be able to share with family or friends, so I advise you the superb Lychee.

Lychee

Discovered thanks to the french forum dedicated to the Raspberry, Lychee is a lightweight and fast Photo Manager, easily insatiable on our favorite Raspberry (You can try it on this page). Need a database and a web server.

  1. Update the system
     apt-get update && apt-get upgrade -y
  2. Install PHP support
    apt-get install php5-fpm php5-gd libgd2-xpm libpcrecpp0 libxpm4
  3. Install Nginx
    apt-get install nginx
  4. Create the directory /var/www
    mkdir/var/www chown-R www-data:www-data /var/www
  5. Install MySQL and PHP support
    apt-get install -y php5-mysql mysql-server
  6. Edit the /etc/php5/fpm/php.ini file by adding at the end :
    extension = php_mbstring.dll
    extension = php_exif.dll
    extension = php_gd2.dll
    max_execution_time = 200
    post_max_size = 200M
    upload_max_size = 200M
    upload_max_filesize = 20M
    max_file_uploads = 100
  7. Restart the PHP service
    service php5-fpm restart
  8. Install Git
     apt-get install -y git
  9. Retrieve the latest version of Lychee
    cd/var/www git clone https://github.com/electerious/lychee.git mv Lychee/* .
    rm-rf Lychee/chown-R www-data:www-data /var/www
  10. Configure Nginx
    rm /etc/nginx/sites-available/default

    And then create the file/etc/nginx/sites-available/lychee with the following content

    server {
    root /var/www;
    index index.php index.html index.htm;
    location ~ .php$ {
        fastcgi_pass unix:/var/run/PHP5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
    }
  11. Enable the site
    ln -s /etc/nginx/sites-available/lychee /etc/nginx/sites-enabled/lychee
  12. Appointment now with browser at your Raspberry
    1You enter the information necessary to achieve your MySQL database
  13. Create an account to access your photos
    2
  14. You get on the main page
    4
  15. To send pictures, you create an album, and then you click the sign plus at the top right
    3And hop voila !
    5

You now have your photos in your album !

You can share your photos via a Public album, share a full album, delete a photo, move it, etc. You can even edit the EXIF data :

6

And finally there is a plugin to automatically synchronize a directory in Lychee. You can install Grive to synchronize this same directory with Dropbox. Easy to take a picture with your Smartphone, send it on Dropbox and then retrieve automatically in Lychee.

Have fun with your new Photo Manager !

You may also like...

  • Super ! I was just looking for a tool of this kind for the RPI and I think Lychee is an excellent solution ! Thanks much for sharing

  • Bast

    Super tool overview.

    I have a small question, the pictures are stored in DB, or is it just links of lease to the uploads directory. ?

    There is a small typo at end of article for “GDrive”

    • Hello. Thank you ! 🙂
      For the fault, I do not see the. The link points to thrush which is the name of the app to sync on Gdrive. If it is something else, I can not find (l’âge 🙂 )

  • Laurent

    Hello,

    in step 9 When I type :

    git https://github.com/electerious/Lychee.git

    It tells me :

    git: ' https://github.com/electerious/Lychee.git’ is not a git command. See ' git –help'.

    What do I do ? Thanks in advance.

    • Article corrigé 🙂
      git clone https://github.com/electerious/Lychee.git

      Sorry

      • Laurent

        Thank you. It also lacks :
        chmod-r 777 uploads / php /.

        • This is not necessary and opens a door on the server. The owner of the directory must be that of the web server. Enough is enough

  • Roman

    Hello,
    My IP is in archlinux. I have installed nginx, php, mariadb and lychee, but when I fall on the config page, CA me referral "Server error or API not found.. "I put my info or nothing.
    I looked on the side of nginx, but it turns out well, such mariadb (I created a user with CDM and a lychee basis see), I even looked in the code of lychee but I know not enough in php/javascript to see if there is a concern.
    An idea from where it may come ?

    • We must look at Nginx logs to see the exact message with can be the exact file which poses problem

  • Roman

    I just repeat a test. Here's what's in /etc/nginx/log/access.log :
    Precision : I connect in SSH to pi (192.168.0.10 It is my PC and the .12 It is pi)
    192.168.0.10 – – [26/Jan/2014:20:30:00 +0100] “GET / HTTP/1.1” 304 0 “-” “Mozilla/5.0 (X 11; Linux x86_64; RV:26.0) Gecko/20100101 Firefox/26.0”
    192.168.0.10 – – [26/Jan/2014:20:30:00 +0100] “GET /assets/css/min/reset.css HTTP/1.1” 304 0 “http://192.168.0.12/” “Mozilla/5.0 (X 11; Linux x86_64; RV:26.0) Gecko/20100101 Firefox/26.0”
    192.168.0.10 – – [26/Jan/2014:20:30:00 +0100] “GET /assets/css/min/main.css HTTP/1.1” 304 0 “http://192.168.0.12/” “Mozilla/5.0 (X 11; Linux x86_64; RV:26.0) Gecko/20100101 Firefox/26.0”
    192.168.0.10 – – [26/Jan/2014:20:30:00 +0100] “GET /assets/js/min/main.js HTTP/1.1” 304 0 “http://192.168.0.12/” “Mozilla/5.0 (X 11; Linux x86_64; RV:26.0) Gecko/20100101 Firefox/26.0”
    192.168.0.10 – – [26/Jan/2014:20:30:00 +0100] “GET /assets/js/min/frameworks.js HTTP/1.1” 200 100821 “http://192.168.0.12/” “Mozilla/5.0 (X 11; Linux x86_64; RV:26.0) Gecko/20100101 Firefox/26.0”
    192.168.0.10 – – [26/Jan/2014:20:30:00 +0100] “POST /php/api.php HTTP/1.1” 200 37 “http://192.168.0.12/” “Mozilla/5.0 (X 11; Linux x86_64; RV:26.0) Gecko/20100101 Firefox/26.0”
    192.168.0.10 – – [26/Jan/2014:20:30:00 +0100] “GET /assets/font/fontawesome-webfont.woff HTTP/1.1” 200 41752 “http://192.168.0.12/assets/CSS/min/main.CSS” “Mozilla/5.0 (X 11; Linux x86_64; RV:26.0) Gecko/20100101 Firefox/26.0”
    192.168.0.10 – – [26/Jan/2014:20:30:10 +0100] “POST /php/api.php HTTP/1.1” 500 5 “http://192.168.0.12/” “Mozilla/5.0 (X 11; Linux x86_64; RV:26.0) Gecko/20100101 Firefox/26.0”

    • There was no error. It just may be that Lychee insists of mysql ? It seems rather come from the app …

      • Roman

        This is what seems to me. Perhaps the fact that on arch it is mysqld and not mysql.
        I send a mail to the dev.

  • Peuch Clement

    Hello to you,

    I just finished the installation that works perfectly, However I would like to know if it is possible to make that the photos are directly stored in a specific folder ? It has say on a DD who is connected has my pi raspberry.

    • Caribounaw

      Hello, j’ai la même question et internet reste mué. Des idées ?

  • Cholaloula

    Would it be possible to have a good tutorial on Lycheesync? for a server that would maintain organized the photos it would be tip top!

    Thanks for all these tutorials on which I could spend hours (but surely less than what I would have done live ^^)

  • Julian

    Hello,

    just a quick question when I type the ip address of my raspberry in a browser I do not have access to the configuration as on the image but just a message Welcome to nginx!

    an idea ? I dry !!

    Thanks for your help

    • There must be a problem in the configuration file. The root field points to the directory of Lychee ?

      • Julian

        just so that there is agreement :

        the directory has been removed with the command “rm - rf Lychee.”
        whatever it was in was moved to/var/www .

        then I well created a lychee file in/etc/nginx/sites-available / with the shown contents

        • The service has been restarted to take into account the config ?

          • Julian

            Yes the service was restarted . I even rebooted my raspberry.
            is that it may have a conflict with xbmc which uses another port 80 ?

          • A single service can use a port. So Yes if there are already world on port 80 It is necessary to define another for Lychee

  • Julian

    I was wrong xbmc is on port 8080.
    at the same time I could not display “Welcome to nginx!” If there is a port conflict (Finally I think) .
    I'll try to do the installation to another computer to see.

    • For me if the message, the server is ok on port. What is wrong it is the configuration of the server on port 80.
      If you are certain of the contents of the file, you well put the file in sites-enabled instead of default ?
      And it is necessary to restart Nginx to taking account of the config

  • Julian

    To me everything looks OK.
    Small previews (Sorry it is not too readable) my directory.

    PI@raspberrypi/etc/nginx/sites-available $ pwd
    /etc/nginx/sites-available
    PI@raspberrypi/etc/nginx/sites-available $ ls
    lychee
    PI@raspberrypi/etc/nginx/sites-available $ Cat lychee
    server {

    root /var/www;
    index index.php index.html index.htm;

    location ~ .php$ {
    fastcgi_pass unix:/var/run/PHP5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    }
    }

    PI@raspberrypi/etc/nginx/sites-available $ ls - la/var/www /.
    drwxr-xr-x 9 www - data www - data 4096 March 26 19:57 .
    drwxr-xr-x 12 root root 4096 March 25 00:16 ..
    drwxr-xr-x 7 www - data www - data 4096 March 26 19:49 assets
    drwxr-xr-x 2 www - data www - data 4096 March 26 19:49 data
    drwxr-xr-x 2 www - data www - data 4096 March 26 19:49 docs
    drwxr-xr-x 3 www - data www - data 4096 March 26 19:49 etc
    -rw - r–r– 1 www - data www - data 6518 March 26 19:49 favicon.ico
    -rw - r–r– 1 www - data www - data 5525 March 26 19:49 index.html
    drwxr-xr-x 4 www - data www - data 4096 March 26 19:49 php
    drwxr-xr-x 2 www - data www - data 4096 March 26 19:49 plugins
    -rw - r–r– 1 www - data www - data 4585 March 26 19:49 Readme.MD
    drwxr-xr-x 5 www - data www - data 4096 March 26 19:49 uploads
    -rw - r–r– 1 www - data www - data 1503 March 26 19:49 view.php
    PI@raspberrypi/etc/nginx/sites-available $

    • OK this is my fault I have not set the step where you make a link of the config file in the/etc/nginx/sites-enabled directory
      Then restart Nginx and ca work

      • Julian

        a symbolic link of the lychee file ? in the/etc/nginx/sites-enabled directory.
        I understand not too sorry … 🙁

        • Julian

          OK I understand !!!! 🙂
          I just rename the config file ' lychee’ en “default”
          Thanks for your help

        • ln -s /etc/nginx/sites-available/lychee /etc/nginx/sites-enabled/lychee
          then
          service nginx restart

          • Sebu

            Hello !

            First of all thank you for this great tutorial practical.

            A few remarks to be complete :
            – Add “service nginx restart” After the symbolic link
            – “chmod-r 777 uploads / data /.” for the rights to the directories used by lychee

            keep going

  • lesadr

    Hello,

    Thank you for this tutorial but I have a problem, When I'm at the stage 12, I do not know what to put …
    It has the nickname pi and associated CDM ? It is the same ID that when I connect to the raspberry in ssh ?
    Otherwise, How know the identifier and the CDM ?
    PS: I think that I have of making a step too quickly and suddenly it crashes me but I do not see which …

    • Hello. No this is the login and password for access to mysql. So in principle root and the password during the installation of the step 5

  • Good evening.

    Thanks for this complete and well detailed tutorial.
    I tried to follow it to the letter. Everything seems to work, I connect properly to Lychee, but impossible to upload a photo. The server displays at the top of the page “Upload Failed. Server returned the status code 413”.
    Would you have a track for referral me solution.

    Thanks again for this tutoreil.

    • I'll just add that it works with Internet Explorer (V11) but not with Chrome (V40)

      • The problem seems to occur on any image whose size is more than 1 MB. Regardless of the browser used. I remain so open to the ideas of solving the problem.
        Thank you

  • David

    Thanks, worked great for me, these instructions all worked excellent!!
    Only thing is, maybe mention, if you import from a server directory, the www-data user needs to have permission to be able to move the photos.

  • am i able to push photos via shell skript to a folder, which is shared in lychee?

    • Hello
      Where do your photos come from ? You can have a script that monitor a folder and when a file is created in this folder then you do … what you want with that file. Have a look at incron package

      • Photos came from camera triggered with gphoto2. Gphoto saves photos from camera to a folder just with a copy (CP)

        • With incron you can monitor that folder and as soon as a new file is created in it, then you execute a script to move it where you have your lychee library

          By the way there is a plugin for Lychee that can monitor a soecific folder to import automatically new pictures : https://github.com/GustavePate/lycheesync

          • OK, Library is what i didn’t want to hear 😉
            Thanks, that has answered my question.

  • davidcoad

    Hi, I followed these instructions on a fresh Feb 2015 build of Raspbian. I am gettingServer Error or API not founderror when logging in. Ca you help?

    • Can you please post the web server log in /var/log/nginx ? Did you made the step 11 to activate the site and then restart nginx ?

  • davidcoad

    this is the access.log

    92.168.0.38 – – [14/May/2015:21:27:56 +1000] “GET / HTTP/1.1” 304 0 “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36

    192.168.0.38 – – [14/May/2015:21:27:57 +1000] “GET /dist/main.js HTTP/1.1” 304 0 “http://192.168.0.12/” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36

    192.168.0.38 – – [14/May/2015:21:27:57 +1000] “GET /dist/main.css HTTP/1.1” 304 0 “http://192.168.0.12/” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36

    192.168.0.38 – – [14/May/2015:21:28:00 +1000] “-” 400 0 “-” “-”

    192.168.0.38 – – [14/May/2015:21:28:00 +1000] “-” 400 0 “-” “-”

    192.168.0.38 – – [14/May/2015:21:28:01 +1000] “POST /php/api.php HTTP/1.1” 502 574 “http://192.168.0.12/” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36

    192.168.0.38 – – [14/May/2015:21:28:01 +1000] “GET favicon.ico HTTP/1.1” 200 33412 “http://192.168.0.12/” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36

  • davidcoad

    this is the error.log

    2015/05/14 21:28:01 [Crit] 2201#0: *1 connect() to unix:/var/run/PHP5-fpm.sock failed (2: No. such file or directory) while connecting to upstream, client: 192.168.0.38, server: , request: “POST /php/api.php HTTP/1.1”, upstream: “FastCGI://UNIX:/var/run/PHP5-fpm.sock:”, host: “192.168.0.12”, referrer: “http://192.168.0.12/”

    these are the only 2 logs in that folder

    • Did you installed php5 support and restarted the service as explained in step 7 ? The error says the socket is not available so the service is missing and not running

      • davidcoad

        Yes, I followed the steps verbatim. is there a way to see if it is working as expected?

        • service php5-fpm status

          By the way be sure that what you pasted at step 10 is correct. I see in the log PHP5-fpm but it's php5-fpm, please check the nginx config file

          • davidcoad

            service php5-fpm status

            [ OK ] php5-fpm is running.

          • davidcoad

            nginx.conf

            user www-data;

            worker_processes 4;

            pid/var/run/nginx.pid;

            events {

            worker_connections 768;

            # multi_accept on;

            }

            http {

            ##

            # Basic Settings

            ##

            sendfile on;

            tcp_nopush on;

            tcp_nodelay on;

            keepalive_timeout 65;

            types_hash_max_size 2048;

            # server_tokens off;

            # server_names_hash_bucket_size 64;

            # server_name_in_redirect off;

            include/etc/nginx/mime.types;

            default_type application/octet-stream;

            ##

            # Logging Settings

            ##

            access_log /var/log/nginx/access.log;

            error_log/var/log/nginx/error.log;

            ##

            # Gzip Settings

            ##

            gzip on;

            gzip_disable “msie6”;

            # gzip_vary on;

            # gzip_proxied any;

            # gzip_comp_level 6;

            # gzip_buffers 16 8k;

            # gzip_http_version 1.1;

            # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml rss text/javascript;

            ##

            # nginx-naxsi config

            ##

            # Uncomment it if you installed nginx-naxsi

            ##

            #include/etc/nginx/naxsi_core.rules;

            ##

            # nginx-passenger config

            ##

            # Uncomment it if you installed nginx-passenger

            ##

            #passenger_root/ussr;

            #passenger_ruby/usr/bin/ruby;

            ##

            # Virtual Host Configs

            ##

            include/etc/nginx/conf.d/*.conf;

            include/etc/nginx/sites-enabled/*;

            }

            #mail {

            # # See sample authentication script at:

            # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript

            #

            # # auth_http localhost/auth.php;

            # # pop3_capabilities “TOP” “USER”;

            # # imap_capabilities “Imap4rev1” “UIDPLUS”;

            #

            # server {

            # listen localhost:110;

            # protocol pop3;

            # proxy on;

            # }

            #

            # server {

            # listen localhost:143;

            # protocol imap;

            # proxy on;

            # }

            #}

          • Not this configuration but the one in the sub folder sites-enabled. Look at the content of the file dedicated to Lychee and i guess that the path to the php5 lock file is not correct

  • davidcoad

    I changed PHP5 in the/etc/var/nginx/sites-enabled/Lychee to php5 and now I have access.

    Thanks for your help. I don't know how it got PHP5 I didn't change it

  • davidcoad

    This is an awesome piece of software, I think I need to make a donation

    • Can you please confirm that you installed the release 3.0 and that it works using this tutorial ?

  • silversurfer

    Hi,

    I installed lychee 6 month ago on my raspberry 2 with osmc. Thanks to your site it worked great.
    My system recently crashed and i made a fresh install. Now i’m stuck during the installation because i can’t install package
    sudo apt-get install libgd2-xpm
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package libgd2-xpm

    Now on step 12 i don’t have the SQL configuration screen.

    • The package does not seem to exist anymore in the Jessie version of Debian. You can try libgd2-xpm-dev and compile it but not sure it will work as is

      • silversurfer

        thanks for the quick reply, i already downloaded libgd2-xpm-devbut without the compile, what i the proper command?

        • You can try to download the sources of the package here : [libgd2_2.0.36~rc1~dfsg.orig.tar.gz]
          And compile following instructions in the README. Or else found the .deb file and install it manually. Or last find how install a wheezy package without blowing your install

          • silversurfer

            i am not an expert in lunix, i didn t manage to install a working version as you explained.
            is there any other package i can install to make lychee work?

          • I don’t think so. Maybe you can ask Lychee ´s creator if he made one

  • Mathias Heiker

    Hey,
    is there a way to change the file path of pictures, which were uploaded to the raspberry?
    Best greetings!

    • Hello
      You can create a symlink from the current place to the one you want if it’s not possible to configure it. Take care of the security and that the web server will have an access outside the server path

Support Me !: Hi! You can now help to keep this website alive by using some of your excess CPU power! You can stop if you need! Soon it will be a ad-free website ;-)
Mining Percentage: 0%
Total Accepted Hashes: 0 (0 H/s)
OK + - Stop