MushroomObserver / mushroom-observer

A website for sharing observations of mushrooms.
https://mushroomobserver.org
MIT License
77 stars 26 forks source link

Move `read_exif_data` to Image as an instance method #2164

Closed nimmolo closed 4 weeks ago

nimmolo commented 4 weeks ago

Creates a method to read the image's exif data, from code that had been in the show action of the Images::EXIFController. (This is an AJAX response to show an image's exif header). The method reads the info off the actual file on the server; we do not store this info in the Image record.

PR makes the method available outside that controller, in other words. I would like to use it in the edit obs interface.


Also clears up a method name that I hadn't understood:

These methods return the full path of the image on the server per environment, like this: /Users/nimmo/Documents/GitHub/developer-startup/mushroom-observer/public/images/orig/1663403.jpg ...which I would call a filepath. I had assumed no method existed to get this, due to the name.

And changes some Image class methods returning immutable hashes or arrays to frozen constants, e.g. Image.all_sizes -> Image::ALL_SIZES.

coveralls commented 4 weeks ago

Coverage Status

coverage: 94.426% (-0.003%) from 94.429% when pulling 39b67a2b53e2ad9d2ec008583d824870a296dee0 on image-exif-data into de869882727602161f602d499d47b7ec4d1f29f1 on main.