Skip to content

File.image?

Daniel Berger edited this page May 22, 2021 · 4 revisions

File.image?(file)

The File.image? method will return a boolean to indicate whether or not the file you've specified is an image or not.

For purposes of this library, an image is a file that is identified as a jpeg, gif, png, bmp, tiff or ico file. The implementation does a check against the first few bytes of the file as well as the file extension, though the latter can be disabled.

Clone this wiki locally