balder icon indicating copy to clipboard operation
balder copied to clipboard

/photos/scan creates duplicates

Open nullmedium opened this issue 13 years ago • 2 comments

I moved some images on my server from one old gallery to the uploads folder into a new album. When I called /photos/scan to import the new photos, the scan algorithm created new records for the previous images within the "photos" table.

nullmedium avatar Mar 13 '13 21:03 nullmedium

The script was supposed to ignore existing photos. It uses 'Photo.find_or_initialize_by_path(path)'. I guess this should be changed as path is not really used for photos. Maybe using 'Photo.find_or_initialize_by_file(path)' would work. I assume the existing photos had a null value for path? Can you post some examples of duplicate photos? Or at least the value of 'file'.

espen avatar Mar 14 '13 15:03 espen

When I had a look at my database the "file" column contained the absolute path to the images. The records for the photos I had uploaded earlier, had just the filename. I think, modifying the script to check for the file's basename would work.

If I get to it, I will try a development database to mess with.

nullmedium avatar Mar 14 '13 19:03 nullmedium