umzug auf gitea
This commit is contained in:
71
php/test.php
Normal file
71
php/test.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// $CodeBaseURL = "http://barcode.tec-it.com/barcode.ashx?translate-esc=on&code=EANUCC128&unit=Fit&dpi=96&imagetype=Png&rotation=0&color=000000&bgcolor=FFFFFF&qunit=Mm&quiet=3&download=true&data=";
|
||||
// $CodeBaseURL2 = "http://barcode.tec-it.com/barcode.ashx?translate-esc=on&data=>>CODE<<&code=EANUCC128&unit=Fit&dpi=96&imagetype=Png&rotation=0&color=000000&bgcolor=FFFFFF&qunit=Mm&quiet=0&download=true";
|
||||
|
||||
// for ($i = 1; $i <= 10; $i++){
|
||||
// if ($i<10 ) { $i = "0". $i; }
|
||||
|
||||
// $code = "GX1030100". $i;
|
||||
// $CodeURL = str_replace(">>CODE<<", $code, $CodeBaseURL2);
|
||||
|
||||
// echo $CodeURL ."\n";
|
||||
|
||||
// //$codeImg = file_get_contents($CodeBaseURL ."". $filename);
|
||||
// //file_put_contents("./". $filename .".png", $codeImg);
|
||||
// }
|
||||
|
||||
// //GX103010011"
|
||||
|
||||
|
||||
function mycrop($src, array $rect)
|
||||
{
|
||||
$dest = imagecreatetruecolor($rect['width'], $rect['height']);
|
||||
imagecopy(
|
||||
$dest,
|
||||
$src,
|
||||
0,
|
||||
0,
|
||||
$rect['x'],
|
||||
$rect['y'],
|
||||
$rect['width'],
|
||||
$rect['height']
|
||||
);
|
||||
|
||||
return $dest;
|
||||
}
|
||||
|
||||
$codes = [
|
||||
"GX103010001",
|
||||
"GX103010002",
|
||||
"GX103010003",
|
||||
"GX103010004",
|
||||
"GX103010005",
|
||||
"GX103010006",
|
||||
"GX103010007",
|
||||
"GX103010008",
|
||||
"GX103010009",
|
||||
"GX103010010",
|
||||
];
|
||||
|
||||
|
||||
foreach ($codes as $code) {
|
||||
$origFilename = $code .".png";
|
||||
$newFilename = $code ."_small.png";
|
||||
|
||||
imagepng(mycrop(imagecreatefrompng("./". $origFilename), ['x' => 0, 'y' => 50, 'width' => 292, 'height' => 60]), $newFilename);
|
||||
}
|
||||
|
||||
// $orgCode = imagecreatefrompng("./GX103010009.png");
|
||||
// // var_dump(file_get_contents("./GX103010009.png"));
|
||||
// // return;
|
||||
|
||||
// $newimg = mycrop($orgCode, ['x' => 0, 'y' => 50, 'width' => 292, 'height' => 60]);
|
||||
|
||||
// imagepng($newimg, "./new.png");
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user