everestpipkin / image-scrubber

A friendly browser-based tool for anonymizing photographs taken at protests
https://everestpipkin.github.io/image-scrubber
MIT License
928 stars 82 forks source link

Remove path from input filename, replace extension with .jpg #11

Closed wheany closed 4 years ago

wheany commented 4 years ago

On pc, the filenames get mangled with the addition of C:\fakepath\ to the file path. This patch removes the path portion from the filename. It also replaces the file extension with .jpg, since that's the format the image is saved in.

This should handle both forward and backslashes as well as filenames having no slashes and no file extensions. Only anything after the last dot in the filename is removed, if the filename has multiple dots only the last part is replaced

everestpipkin commented 4 years ago

Thanks! Good call. I added '_scrubbed' to the filepath also to differentiate from the original.