diff --git a/Utils/Barcode/C128Abstract.php b/Utils/Barcode/C128Abstract.php index cb68f0851..e02a65897 100644 --- a/Utils/Barcode/C128Abstract.php +++ b/Utils/Barcode/C128Abstract.php @@ -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 *