mirror of
https://github.com/Intervention/image.git
synced 2025-08-31 01:29:51 +02:00
added mime type property
This commit is contained in:
@@ -63,6 +63,13 @@ class Image
|
||||
*/
|
||||
public $filename;
|
||||
|
||||
/**
|
||||
* MIME type of image
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mimetype;
|
||||
|
||||
/**
|
||||
* Attributes of the original created image
|
||||
*
|
||||
@@ -184,7 +191,11 @@ class Image
|
||||
$this->filename = $info['filename'];
|
||||
|
||||
// set image info
|
||||
list($this->width, $this->height, $this->type) = @getimagesize($path);
|
||||
$info = getimagesize($path);
|
||||
$this->width = $info[0];
|
||||
$this->height = $info[1];
|
||||
$this->type = $info[2];
|
||||
$this->mimetype = $info['mime'];
|
||||
|
||||
// set resource
|
||||
switch ($this->type) {
|
||||
|
@@ -22,6 +22,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
||||
$this->assertEquals($img->basename, 'test.jpg');
|
||||
$this->assertEquals($img->extension, 'jpg');
|
||||
$this->assertEquals($img->filename, 'test');
|
||||
$this->assertEquals($img->mimetype, 'image/jpeg');
|
||||
|
||||
$img = new Image(null, 800, 600);
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||
@@ -45,6 +46,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
||||
$this->assertEquals($img->basename, 'test.jpg');
|
||||
$this->assertEquals($img->extension, 'jpg');
|
||||
$this->assertEquals($img->filename, 'test');
|
||||
$this->assertEquals($img->mimetype, 'image/jpeg');
|
||||
}
|
||||
|
||||
public function testCreationFromFile()
|
||||
@@ -59,6 +61,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
||||
$this->assertEquals($img->basename, 'test.jpg');
|
||||
$this->assertEquals($img->extension, 'jpg');
|
||||
$this->assertEquals($img->filename, 'test');
|
||||
$this->assertEquals($img->mimetype, 'image/jpeg');
|
||||
}
|
||||
|
||||
public function testResizeImage()
|
||||
@@ -1074,6 +1077,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
||||
$this->assertEquals($img->basename, 'test.jpg');
|
||||
$this->assertEquals($img->extension, 'jpg');
|
||||
$this->assertEquals($img->filename, 'test');
|
||||
$this->assertEquals($img->mimetype, 'image/jpeg');
|
||||
}
|
||||
|
||||
public function testStaticCallCanvas()
|
||||
|
Reference in New Issue
Block a user