黄智勇 发表于 2017-12-31 06:04:08

侠岚之弋痕夕

PHP exif_imagetype note #1  
Windows users: If you get the fatal error "Fatal error:Call to undefined function exif_imagetype()", and you have enabled php_exif.dll, make sure you enable php_mbstring.dll.
  You must put mbstring before exif in the php.ini, i.e.:
  

  
extension=php_mbstring.dll
  
extension=php_exif.dll
  

  
You can check whether this has worked by calling () and searching for exif.
  
PHP exif_imagetype note #2
  
If the function exif_imagetype() is not available,
  
you can try the following workaround:
  

  
if ( ! function_exists( 'exif_imagetype' ) ) {
  function exif_imagetype ( $filename ) {
  if ( ( list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false ) {
  return $type;
  }
  return false;
  }
  
}
  
PHP exif_imagetype note #3
  
By trial and error, it seems that ahas to be 12 bytes or larger in order to avoid a "Read error!".Here's a work-around to avoid an error being thrown:
  

  
// exif_imagetype throws "Read error!" if file is too small
  
if (filesize($uploadfile) > 11)
  $mimetype = exif_imagetype($uploadfile);
  
else
  $mimetype = false;
  
PHP exif_imagetype note #4

  
Seems to give a 'Read error' warning if the>  
PHP exif_imagetype note #5

  
libexif can also be used to parse image info out of>  

  
exif_read_data("mp3_with_2.4ID3TAGS, '', true, false);
  
PHP exif_imagetype note #6

  
After looking for hours, I found a very good source for exif>
  
It lists exif specifications (pdf), a few good links to exif>
页: [1]
查看完整版本: 侠岚之弋痕夕