5
0
mirror of https://github.com/cwinfo/php-barcode.git synced 2024-11-24 01:41:58 +00:00

Tweak default scale and padding for matrix barcodes.

This commit is contained in:
Rebecca G. Bettencourt 2016-06-21 19:01:38 -07:00
parent 68c8582923
commit 26e9a5945c
4 changed files with 50 additions and 42 deletions

View File

@ -65,13 +65,13 @@ barcode.php?f=svg&s=qr&d=HELLO%20WORLD&sf=8&ms=r&md=0.8
`h` - Height of image. Overrides `sf` or `sy`.
`sf` - Scale factor.
`sf` - Scale factor. Default is 1 for linear barcodes or 4 for matrix barcodes.
`sx` - Horizontal scale factor. Overrides `sf`.
`sy` - Vertical scale factor. Overrides `sf`.
`p` - Padding. Default is 10.
`p` - Padding. Default is 10 for linear barcodes or 0 for matrix barcodes.
`pv` - Top and bottom padding. Default is value of `p`.

File diff suppressed because one or more lines are too long

View File

@ -117,7 +117,10 @@ barcode.php?f=svg&s=qr&d=HELLO%20WORLD&sf=8&ms=r&md=0.8
</tr>
<tr>
<td><code>sf</code></td>
<td>Scale factor.</td>
<td>
Scale factor.
Default is 1 for linear barcodes or 4 for matrix barcodes.
</td>
</tr>
<tr>
<td><code>sx</code></td>
@ -129,7 +132,10 @@ barcode.php?f=svg&s=qr&d=HELLO%20WORLD&sf=8&ms=r&md=0.8
</tr>
<tr>
<td><code>p</code></td>
<td>Padding. Default is 10.</td>
<td>
Padding.
Default is 10 for linear barcodes or 0 for matrix barcodes.
</td>
</tr>
<tr>
<td><code>pv</code></td>

View File

@ -148,10 +148,12 @@ class barcode_generator {
(isset($options['w9']) ? (int)$options['w9'] : 1),
);
$size = $this->dispatch_calculate_size($code, $widths, $options);
$scale = (isset($options['sf']) ? (float)$options['sf'] : 1);
$dscale = ($code && isset($code['g']) && $code['g'] == 'm') ? 4 : 1;
$scale = (isset($options['sf']) ? (float)$options['sf'] : $dscale);
$scalex = (isset($options['sx']) ? (float)$options['sx'] : $scale);
$scaley = (isset($options['sy']) ? (float)$options['sy'] : $scale);
$padding = (isset($options['p']) ? (int)$options['p'] : 10);
$dpadding = ($code && isset($code['g']) && $code['g'] == 'm') ? 0 : 10;
$padding = (isset($options['p']) ? (int)$options['p'] : $dpadding);
$vert = (isset($options['pv']) ? (int)$options['pv'] : $padding);
$horiz = (isset($options['ph']) ? (int)$options['ph'] : $padding);
$top = (isset($options['pt']) ? (int)$options['pt'] : $vert);