Add save to file method

This commit is contained in:
Dennis Eichhorn 2017-11-15 16:59:52 +01:00
parent 220ea81f3e
commit 73d2780d48

View File

@ -227,6 +227,40 @@ abstract class C128Abstract
return $this->createImage($codeString, 20);
}
/**
* Save to file
*
* @param string $file File path/name
*
* @return void
*
* @since 1.0.0
*/
public function saveToPngFile(string $file) /* : void */
{
$res = $this->get();
imagepng($res, $file);
imagedestroy($res);
}
/**
* Save to file
*
* @param string $file File path/name
*
* @return void
*
* @since 1.0.0
*/
public function saveToJpgFile(string $file) /* : void */
{
$res = $this->get();
imagejpeg($res, $file);
imagedestroy($res);
}
/**
* Generate weighted code string
*