image() 공개 메소드

Sniff images
public image ( ) : string
리턴 string Actual Content-Type
예제 #1
0
 /**
  * Test if the file is an image
  * @param string $url the url to the file
  * @return bool true if image
  */
 protected function isImage($url)
 {
     // check for empty urls
     if (!$url) {
         return false;
     }
     $file = $this->getFile($url);
     $sniffer = new \SimplePie_Content_Type_Sniffer($file);
     return $sniffer->image() !== false;
 }
예제 #2
0
 /**
  * Test if the file is an image
  * @param string $url the url to the file
  * @return bool true if image
  */
 protected function isImage($url)
 {
     // check for empty urls
     if (!$url) {
         return false;
     }
     $file = $this->getFile($url);
     $status_range = (string) substr($file->status_code, 0, 1);
     //echo $status_range;
     if ($status_range == 2 || $status_range == 3 || !empty($status_range)) {
         // 200's are a good response and 300's are redirects
         $sniffer = new \SimplePie_Content_Type_Sniffer($file);
         return $sniffer->image() !== false;
     }
 }