Title: exif_imagetype php error
Last modified: May 2, 2022

---

# exif_imagetype php error

 *  Resolved [whitedd](https://wordpress.org/support/users/whitedd/)
 * (@whitedd)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/exif_imagetype-php-error/)
 * I have Pro version and plugin throw error every half hour…error is: PHP Warning:
   exif_imagetype(): stream does not support seeking in /home/XXXXXX/public_html/
   wp-includes/functions.php on line 3245
 * and content is:
 *     ```
       function wp_get_image_mime( $file ) {
       	/*
       	 * Use exif_imagetype() to check the mimetype if available or fall back to
       	 * getimagesize() if exif isn't avaialbe. If either function throws an Exception
       	 * we assume the file could not be validated.
       	 */
       	try {
       		if ( is_callable( 'exif_imagetype' ) ) {
       			$imagetype = exif_imagetype( $file );
       			$mime      = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false;
       		} elseif ( function_exists( 'getimagesize' ) ) {
       			// Don't silence errors when in debug mode, unless running unit tests.
       			if ( defined( 'WP_DEBUG' ) && WP_DEBUG
       				&& ! defined( 'WP_RUN_CORE_TESTS' )
       			) {
       				// Not using wp_getimagesize() here to avoid an infinite loop.
       				$imagesize = getimagesize( $file );
       			} else {
       				// phpcs:ignore WordPress.PHP.NoSilencedErrors
       				$imagesize = @getimagesize( $file );
       			}
   
       			$mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false;
       		} else {
       			$mime = false;
       		}
   
       		if ( false !== $mime ) {
       			return $mime;
       		}
   
       		$handle = fopen( $file, 'rb' );
       		if ( false === $handle ) {
       			return false;
       		}
   
       		$magic = fread( $handle, 12 );
       		if ( false === $magic ) {
       			return false;
       		}
   
       		/*
       		 * Add WebP fallback detection when image library doesn't support WebP.
       		 * Note: detection values come from LibWebP, see
       		 * https://github.com/webmproject/libwebp/blob/master/imageio/image_dec.c#L30
       		 */
       		$magic = bin2hex( $magic );
       		if (
       			// RIFF.
       			( 0 === strpos( $magic, '52494646' ) ) &&
       			// WEBP.
       			( 16 === strpos( $magic, '57454250' ) )
       		) {
       			$mime = 'image/webp';
       		}
   
       		fclose( $handle );
       	} catch ( Exception $e ) {
       		$mime = false;
       	}
   
       	return $mime;
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Support [elviiso](https://wordpress.org/support/users/elviiso/)
 * (@elviiso)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/exif_imagetype-php-error/#post-15617864)
 * Hi [@whitedd](https://wordpress.org/support/users/whitedd/)
 * I’m sorry to learn that you are going through this issue.
 * Since you are a PRO user, to be able to quickly and effectively assist you with
   this, I’d like to kindly ask you to open a ticket at our premium support forum
   which is available for only PRO users. Our support team will then get back to
   you as soon as possible with a response.
 * Kindly include all of the relevant information that will assist us to investigate
   what’s causing this: [https://fooplugins.com/support/](https://fooplugins.com/support/)
 * Hoping to hear from you soon on our premium forum! I will now be closing this
   ticket.
 * Kind regards,
    Elvis.

Viewing 1 replies (of 1 total)

The topic ‘exif_imagetype php error’ is closed to new replies.

 * ![](https://ps.w.org/foogallery/assets/icon-256x256.gif?rev=2602542)
 * [Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel](https://wordpress.org/plugins/foogallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/foogallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/foogallery/)
 * [Active Topics](https://wordpress.org/support/plugin/foogallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/foogallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/foogallery/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [elviiso](https://wordpress.org/support/users/elviiso/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/exif_imagetype-php-error/#post-15617864)
 * Status: resolved