uploads: fix getting dimensions of flash files
MediaFile#dimensions is called twice - in #width and in #height but it only works on the first call because the file is read to the end and consumed the first time so when #read is called the second time it only returns the empty string
This commit is contained in:
@@ -5,7 +5,7 @@ class MediaFile::Flash < MediaFile
|
||||
def dimensions
|
||||
# Read the entire stream into memory because the
|
||||
# dimensions aren't stored in a standard location
|
||||
contents = file.read.force_encoding("ASCII-8BIT")
|
||||
contents = File.read(file.path, binmode: true).force_encoding("ASCII-8BIT")
|
||||
|
||||
# Our 'signature' is the first 3 bytes
|
||||
# Either FWS or CWS. CWS indicates compression
|
||||
|
||||
Reference in New Issue
Block a user