diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index ee214e9..966dcd8 100644
--- src/wp-includes/functions.php
+++ src/wp-includes/functions.php
@@ -2367,7 +2367,8 @@ function wp_get_image_mime( $file ) {
 	 */
 	try {
 		if ( is_callable( 'exif_imagetype' ) ) {
-			$mime = image_type_to_mime_type( exif_imagetype( $file ) );
+			$imagetype = exif_imagetype( $file );
+			$mime = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false;
 		} elseif ( function_exists( 'getimagesize' ) ) {
 			$imagesize = getimagesize( $file );
 			$mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false;
diff --git tests/phpunit/tests/functions.php tests/phpunit/tests/functions.php
index a3aba79..50ea235 100644
--- tests/phpunit/tests/functions.php
+++ tests/phpunit/tests/functions.php
@@ -916,6 +916,23 @@ class Tests_Functions extends WP_UnitTestCase {
 	}
 
 	/**
+	 * @ticket 40017
+	 */
+	public function test_wp_get_image_mime() {
+		if ( ! is_callable( 'exif_imagetype' ) && ! function_exists( 'getimagesize' ) ) {
+			$this->markTestSkipped( 'The exif PHP extension is not loaded.' );
+		}
+
+		// Test a valid image.
+		$out = wp_get_image_mime( DIR_TESTDATA.'/images/2004-07-22-DSC_0008.jpg' );
+		$this->assertEquals( 'image/jpeg', $out );
+
+		// Test a non-image file.
+		$out = wp_get_image_mime( DIR_TESTDATA.'/uploads/dashicons.woff' );
+		$this->assertEquals( false, $out );
+	}
+
+	/**
 	 * @ticket 39550
 	 * @dataProvider _wp_check_filetype_and_ext_data
 	 */
