• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Get pictures from synology NAS - "Rediscover This Day"

Scheduled Pinned Locked Moved General Discussion
9 Posts 5 Posters 4.9k Views 7 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    schmucke
    last edited by schmucke Feb 11, 2017, 10:29 PM Feb 11, 2017, 10:10 PM

    Hey,

    is anyone here who is needing a solution to show own images from the past years? Like the Facebook remember function? The job to sort the images runs on the synology and works with: mysql, exiv2 and copy. I get the Exif data from each image and write it in a sqldb. with bash i get the files in a local folder (incl. resize for the mirror). The raspberry is copy the images in a local folder. Here dit i use the MMM-ImagesPhoto Plugin.

    my solution ist very simple and usable with the latest synology firmware. If anyone want read this, in wich category can i post it?!
    Not the right resolution, but you can see the what i mean…

    screenshot

    1 Reply Last reply Reply Quote 1
    • T Offline
      Tifendro
      last edited by Apr 13, 2018, 6:27 AM

      Hi !!!
      that’s the exact function that i want !
      I also have a synology where my pics are stored !

      Can you please contact me with your Project info or write it down there ?

      Thank you very much

      1 Reply Last reply Reply Quote 0
      • C Offline
        cyberphox
        last edited by Apr 13, 2018, 11:03 AM

        Own a Synology and would LOVE to do this!! Contact me for sure…interested!!

        Full time Dad, DJ and entertainer and lover of technology.

        1 Reply Last reply Reply Quote 0
        • S Offline
          schmucke
          last edited by schmucke Apr 13, 2018, 2:10 PM Apr 13, 2018, 2:06 PM

          Hello,

          i help me here very simple. on the Magicmirror side, i have a cronjob what get pictures every day per ssh/scp. To use this, i have add the magicmirror device to the knownhosts on the synology side (google for it).

          on Synology side:
          This Script is get the exif data of the images. write it to a CSV and then, get the path and write it to a mysqldb (This Script i run once every year one time per hand … i dont know it works perfectly… I think, that here are better coding people… this is quick and dirty. But it works for me. I cant show the Magicmirror side now, i am not at home - but you can use every Plugin with a upload folder… i can show my “Plugin” in the next days if you want…

          #!/bin/bash
          # 
          # This script is get the exif data (if set) from all
          # pictures (jpg/JPG) in a define path (recursiv).
          # It writes the data to am MYSQL Database.
          #
          # It works native with Synology DSM (Tested with 6.0.2-xxxx)
          #
          # To use this script, put in the  root folder of your photos
          # chmod 775 ./listimages.sh make the script executable
          # ./listimages.sh execute the scriptfile
          #
          # Where want you present your files?
          imagepath=/volume1/Intern/Fotos/MagicMirror/
          # Variables for the temp files (will delete at End of the Script
          exportcsv=./export.csv
          importcsv=./import.csv
          
          # MySql Data
          
          username=root
          password=PASSWORD
          database=ExifData
          table=Bilder
          
          shopt -s globstar extglob
          exiv2 -pa -g DateTimeOriginal **/*.@(jpg|JPG) |
          awk -v pwd="$PWD/" -v dq='"' -v OFS=',' '{
              fn = substr($0, 1, match($0, / *Exif\.Photo/)-1)
          	    print dq pwd fn dq,  dq $(NF-1) dq, dq $NF dq
          		}' >$exportcsv
          
          mysql -u$username -p$password -e "use $database" -e "
          TRUNCATE Bilder;"
          
          # Write data to mysql
          for f in $exportcsv
          do
          mysql -u$username -p$password -e "use $database" -e "
          		LOAD DATA LOCAL INFILE '$f'
          		INTO TABLE $table
          		FIELDS TERMINATED BY ',' 
          		OPTIONALLY ENCLOSED BY '\"' 
          		LINES TERMINATED BY '\n' 
          		(path,date,time);"
          done
          

          This script is copying and resizing the images:

          importcsv=/volume1/Intern/Fotos/Bilder/import.csv
          imagepath=/volume1/Intern/Fotos/MagicMirror/
          #remove old images
          rm /volume1/Intern/Fotos/Bilder/import.csv
          rm /volume1/Intern/Fotos/MagicMirror/*.*
          #Get Date from tommorow
          DATE=$(date --date='1 day' +%m-%d)
          #DATE=$(date +%m-%d)
          
          #MYSQL Query by date from tomorrow
          id=$(mysql -uroot -pPASSWORD -s -N -e "SELECT path FROM ExifData.Bilder WHERE date like '%$DATE' INTO OUTFILE '$importcsv' FIELDS TERMINATED BY ',' ENCLOSED BY ''")
          # Copy files with exifdata from tomorow before one,two, three or whatever years
          while read p; do
          cp "$p" $imagepath
          done < $importcsv #(DELETE THE SPACE BETWEEN < AND $!!!!)
          
          
          cd $imagepath
          shopt -s nullglob
          i=0
          for f in *.JPG *.jpg *.jpeg; do
            exiv2 -r "$i"_%d.%m.%Y_%H.%M.%S rename ./"$f"
            i=$((i+1))
            done
          
          for f in *.JPG *.jpg *.jpeg; do
          	convert -thumbnail 800 ./"$f" ./"${f%}.jpg"
          	rm ./"$f"
          done
          

          I hope this helps - you can do it! Have fun!

          1 Reply Last reply Reply Quote 1
          • T Offline
            Tifendro
            last edited by Apr 13, 2018, 2:18 PM

            Awesome ! I will try this soon !! Thank’s again !

            1 Reply Last reply Reply Quote 0
            • T Offline
              Tifendro
              last edited by Apr 16, 2018, 9:40 AM

              what about your photo plugin ?

              Y 1 Reply Last reply Apr 16, 2018, 10:04 AM Reply Quote 0
              • Y Offline
                yawns Moderator @Tifendro
                last edited by Apr 16, 2018, 10:04 AM

                @Tifendro
                https://github.com/roramirez/MMM-ImagesPhotos

                1 Reply Last reply Reply Quote 0
                • S Offline
                  schmucke
                  last edited by Apr 16, 2018, 10:23 AM

                  Yes @yawns,

                  this is the plugin what i use. i have only customize the css stuff.

                  https://github.com/roramirez/MMM-ImagesPhotos

                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    Gabev
                    last edited by Apr 18, 2018, 11:48 AM

                    would LOVE to do this!!

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Enjoying MagicMirror? Please consider a donation!
                    MagicMirror created by Michael Teeuw.
                    Forum managed by Sam, technical setup by Karsten.
                    This forum is using NodeBB as its core | Contributors
                    Contact | Privacy Policy