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