mirror of
https://github.com/Intervention/image.git
synced 2025-08-30 17:19:50 +02:00
Store and expose result of latest encoded image.
This commit is contained in:
@@ -83,6 +83,14 @@ class Image
|
||||
*/
|
||||
public $cached = false;
|
||||
|
||||
/**
|
||||
* Result of image after encoding
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $encoded;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance of Image class
|
||||
*
|
||||
@@ -1441,11 +1449,11 @@ class Image
|
||||
break;
|
||||
}
|
||||
|
||||
$data = ob_get_contents();
|
||||
$this->encoded = ob_get_contents();
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
return $data;
|
||||
return $this->encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1748,4 +1748,11 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
||||
$this->assertEquals('#00aef0', $img->pickColor(6, 6, 'hex'));
|
||||
$this->assertEquals('#f6a609', $img->pickColor(11, 25, 'hex'));
|
||||
}
|
||||
|
||||
public function testEncoded()
|
||||
{
|
||||
$img = Image::make('public/test.jpg');
|
||||
$img->encode();
|
||||
$this->assertEquals($img->encoded, $img->encode());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user