metadata: add CLI script for printing image metadata
Add a utility script for printing image metadata from the command line. Usage: `bin/lsmetadata 1.jpg 2.jpg`
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
# supported by a File.
|
||||
class MediaFile
|
||||
extend Memoist
|
||||
include ActiveModel::Serializers::JSON
|
||||
|
||||
attr_accessor :file
|
||||
|
||||
# delegate all File methods to `file`.
|
||||
@@ -168,5 +170,18 @@ class MediaFile
|
||||
nil
|
||||
end
|
||||
|
||||
def attributes
|
||||
{
|
||||
path: path,
|
||||
width: width,
|
||||
height: height,
|
||||
file_ext: file_ext,
|
||||
file_size: file_size,
|
||||
md5: md5,
|
||||
is_corrupt?: is_corrupt?,
|
||||
metadata: metadata
|
||||
}.stringify_keys
|
||||
end
|
||||
|
||||
memoize :file_ext, :file_size, :md5, :metadata
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user