-
-
Notifications
You must be signed in to change notification settings - Fork 6
File.image?
Daniel Berger edited this page May 24, 2021
·
4 revisions
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.
Instead of checking for a generic image result, you can check for a specific type of image using the following methods:
- File.bmp?
- File.jpg?
- File.gif?
- File.ico?
- File.png?
- File.tiff?