The File.width property is an extension of DropzoneJS and is not part of the main File API ; It is added later.
Dropzone adds data to a file that you can use when events fire. You can access File.width and file.height if this is an image.
If applicable, image size information becomes available at the time of the "thumbnail" event. It cannot be installed before this event.
The documentation is not very clear in this case, if you only refer to "when the sketch was created", but this is the source behavior (see createThumbnail / resize) - the image size is collected when the sketch is created.
The original behavior is visible due to the fact that console.log (in browsers such as Chrome, which relate to it similarly to console.dir ) displays a "live" object. This, in turn, provided enough time to generate an asynchronous sketch and the associated image size measurement to complete before the browser displays the objects currently in the console. (This also explains why using a timeout to read the value of a property works - although this is not a reliable approach.)
On the other hand, direct access to File.width leads to an immediate evaluation of the properties of the fixed object, which results in undefined in the "addedFile" .
source share