Get pictures from synology NAS - "Rediscover This Day"



  • 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



  • 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



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



  • 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!



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



  • what about your photo plugin ?


  • Moderator



  • Yes @yawns,

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

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



  • would LOVE to do this!!


 

340
Online

6.0k
Users

4.5k
Topics

37.1k
Posts