getBinary() public method

Outputs image as binary data
public getBinary ( null | string $format = null, integer | null $quality = null ) : string
$format null | string If omitted or null - format of original file will be used, may be gif|jpg|png
$quality integer | null Output image quality in percents 0-100
return string
Beispiel #1
0
 public function testGetBinary()
 {
     $original = Helper::getOrig('smile.gif');
     $img = new Image($original);
     isContain('47494638396110001000c60000707070a0a0a0eada22f0f0f0cbbd1e2e2b06f3', bin2hex($img->getBinary()));
     isContain('47494638396110001000c60000707070a0a0a0eada22f0f0f0cbbd1e2e2b06f3', bin2hex($img->getBinary(null)));
     isContain('47494638396110001000c60000707070a0a0a0eada22f0f0f0cbbd1e2e2b06f3', bin2hex($img->getBinary('gif')));
     isContain('89504e470d0a1a0a0000000d4948445200000010000000100803000000282d0f', bin2hex($img->getBinary('png')));
     isContain('ffd8ffe000104a46494600010100000100010000fffe003a43524541544f523a', bin2hex($img->getBinary('jpeg')));
     isContain('ffd8ffe000104a46494600010100000100010000fffe003a43524541544f523a', bin2hex($img->getBinary('jpg')));
 }