mirror of
https://github.com/Intervention/image.git
synced 2025-08-31 17:41:58 +02:00
Store and expose result of latest encoded image.
This commit is contained in:
@@ -83,6 +83,14 @@ class Image
|
|||||||
*/
|
*/
|
||||||
public $cached = false;
|
public $cached = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Result of image after encoding
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $encoded;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance of Image class
|
* Create a new instance of Image class
|
||||||
*
|
*
|
||||||
@@ -1441,11 +1449,11 @@ class Image
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = ob_get_contents();
|
$this->encoded = ob_get_contents();
|
||||||
|
|
||||||
ob_end_clean();
|
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('#00aef0', $img->pickColor(6, 6, 'hex'));
|
||||||
$this->assertEquals('#f6a609', $img->pickColor(11, 25, '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