/** * Check if the given file is jpeg file * * @param string $filename * @return boolean true if jpeg false othewise */ public static function isJpegFile($filename) { try { $image = new ImageFile($filename); if (strtolower($image->getMime()) !== @image_type_to_mime_type(IMAGETYPE_JPEG)) { return false; } return true; } catch (\RuntimeException $ex) { return false; } }
/** * @dataProvider fixturesDataProvider * * @param string $file fixture file * @param \Jaguar\Dimension $ed expected dimension * @param type $em expected mime type * @param type $ee expected extension */ public function testAllImageGets($file, Dimension $ed, $em, $ee) { $if = new ImageFile($file); $this->assertTrue($if->getDimension()->equals($ed)); $this->assertEquals($em, $if->getMime()); $this->assertEquals($ee, $if->getExtension()); $this->assertEquals(sprintf('width="%s" height="%s"', $if->getWidth(), $if->getHeight()), $if->__toString()); }