Subiendo proyecto completo sin restricciones de git ignore
16
vendor/simplesoftwareio/simple-qrcode/.github/stale.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 90
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- bug
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: true
|
||||
24
vendor/simplesoftwareio/simple-qrcode/.github/workflows/php.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Unit Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, develop ]
|
||||
pull_request:
|
||||
branches: [ master, develop ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Validate composer.json and composer.lock
|
||||
run: composer validate
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Run test suite
|
||||
run: composer run-script test
|
||||
3
vendor/simplesoftwareio/simple-qrcode/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.idea
|
||||
/vendor
|
||||
composer.lock
|
||||
69
vendor/simplesoftwareio/simple-qrcode/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
Simple QrCode
|
||||
=============
|
||||
|
||||
##Change Log
|
||||
|
||||
#### 2.0.0
|
||||
* Fixed a bug where the merge image was not reset correctly. (#93)
|
||||
* Added Laravel auto discovery support. (#82) - Thanks [mazedlx](https://github.com/mazedlx)
|
||||
|
||||
#### 1.5.1
|
||||
* Fixed a bug where a QrCode used within a loop would not generate correctly.
|
||||
|
||||
#### 1.5.0
|
||||
* Added Portuguese translation. -Thanks [francisek](https://github.com/francisek) and [Varpie!](https://github.com/Varpie)
|
||||
* Added BitCoin helper
|
||||
|
||||
#### 1.4.6
|
||||
* Added Portuguese translation. -Thanks [felipewmartins!](https://github.com/felipewmartins)
|
||||
|
||||
#### 1.4.5
|
||||
* Added Spanish translation. -Thanks [gtarraga!](https://github.com/gtarraga)
|
||||
* Added Hindi translation. -Thanks [himanshu81494!](https://github.com/himanshu81494)
|
||||
|
||||
#### 1.4.4
|
||||
* Added Italian translation. -Thanks [simocosimo!](https://github.com/simocosimo)
|
||||
|
||||
#### 1.4.3
|
||||
* Updated the docs to our new format.
|
||||
* Correct some typos in the Russian translation.
|
||||
|
||||
#### 1.4.2
|
||||
* Added Russian translation. -Thanks Victoria!
|
||||
* Added Chinese translation. -Thanks [blusewang!](https://github.com/blusewang)
|
||||
|
||||
#### 1.4.1
|
||||
* Improved the quality of QrCodes with logos merge on them. -Thanks [tuupke!](https://github.com/tuupke)
|
||||
|
||||
#### 1.4.0
|
||||
* Added the `mergeString` method. This method adds the ability to pass in a binary string to create a QrCode with an image on it. -Thanks [tuupke!](https://github.com/tuupke)
|
||||
|
||||
#### 1.3.3
|
||||
* Allow absolute paths to be used with the `merge` method.
|
||||
|
||||
#### 1.3.2
|
||||
* Changed `bindShared` to `singleton` to support Laravel 5.2 -Thanks [lhdev!](https://github.com/lhdev)
|
||||
|
||||
#### 1.3.1
|
||||
* Fixed a bug where `merge` did not work as expected when used with `size.`
|
||||
|
||||
#### 1.3.0
|
||||
* Added `merge` method.
|
||||
* Fixed a typo in the readme.
|
||||
|
||||
#### 1.2.0
|
||||
* Added full support for Laravel 5
|
||||
* Added the following helpers.
|
||||
* E-Mail
|
||||
* Geo
|
||||
* Phone Number
|
||||
* SMS
|
||||
* WiFi
|
||||
|
||||
#### 1.1.1
|
||||
* Update dependencies.
|
||||
* Corrected some composer file issues.
|
||||
* Added some missing Laravel information to the QrCode Service Provider.
|
||||
|
||||
####1.1.0
|
||||
* Added the ability to change the character encoding.
|
||||
3
vendor/simplesoftwareio/simple-qrcode/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Contribution Guidelines
|
||||
|
||||
Please submit all issues and pull requests to the [simplesoftwareio/simple-qrcode](https://github.com/simplesoftwareio/simple-qrcode) repository on the develop branch!
|
||||
21
vendor/simplesoftwareio/simple-qrcode/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2020 Simple Software LLC www.simplesoftware.io
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
47
vendor/simplesoftwareio/simple-qrcode/README.md
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
Simple QrCode
|
||||
========================
|
||||
|
||||

|
||||
[](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
[](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
[](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
[](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
## [Deutsch](https://www.simplesoftware.io/#/docs/simple-qrcode/de) | [Español](https://www.simplesoftware.io/#/docs/simple-qrcode/es) | [Français](https://www.simplesoftware.io/#/docs/simple-qrcode/fr) | [Italiano](https://www.simplesoftware.io/#/docs/simple-qrcode/it) | [Português](https://www.simplesoftware.io/#/docs/simple-qrcode/pt-br) | [Русский](https://www.simplesoftware.io/#/docs/simple-qrcode/ru) | [日本語](https://www.simplesoftware.io/#/docs/simple-qrcode/ja) | [한국어](https://www.simplesoftware.io/#/docs/simple-qrcode/kr) | [हिंदी](https://www.simplesoftware.io/#/docs/simple-qrcode/hi) | [简体中文](https://www.simplesoftware.io/#/docs/simple-qrcode/zh-cn)
|
||||
|
||||
Language files are currently out of date. We need volunteers to upgrade them to v4! Please submit a PR request!
|
||||
|
||||
### Try our dead simple, free file transfer service [keep.sh](https://keep.sh)
|
||||
|
||||
[](https://keep.sh)
|
||||
|
||||
Easy fast file sharing from the command line with a single curl command! `curl --upload-file your-local-file.txt https://keep.sh`
|
||||
|
||||
## Introduction
|
||||
Simple QrCode is an easy to use wrapper for the popular Laravel framework based on the great work provided by [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). We created an interface that is familiar and easy to install for Laravel users.
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for Simple QrCode can be found on our [website.](http://www.simplesoftware.io/#/docs/simple-qrcode)
|
||||
|
||||
## Examples
|
||||
|
||||
 
|
||||
|
||||
## Use Cases
|
||||
<p align="center">
|
||||
<a href="https://www.rsvpify.com">
|
||||
<img width="300" src="https://rsvpify.com/wp-content/uploads/2017/03/rsvpify-logo-header-rsvp.png">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://rsvpify.com/sell-tickets">Platform to sell tickets online</a>
|
||||
</p>
|
||||
|
||||
## Contributing
|
||||
|
||||
Please submit all issues and pull requests to the [simplesoftwareio/simple-qrcode](https://github.com/simplesoftwareio/simple-qrcode) repository on the develop branch!
|
||||
|
||||
## License
|
||||
|
||||
This software is released under the [MIT license.](https://opensource.org/licenses/MIT)
|
||||
14
vendor/simplesoftwareio/simple-qrcode/SECURITY.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| >= 2.x | :white_check_mark: |
|
||||
| <= 1.x | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report security vulnerabilities responsibility by emailing `security@simplesoftware.io.`
|
||||
|
||||
We will fix the vulnerability privately, push a new release, and then go public with the notification.
|
||||
44
vendor/simplesoftwareio/simple-qrcode/composer.json
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "simplesoftwareio/simple-qrcode",
|
||||
"description": "Simple QrCode is a QR code generator made for Laravel.",
|
||||
"keywords": ["qrcode", "laravel", "simple", "generator", "wrapper"],
|
||||
"homepage": "https://www.simplesoftware.io/#/docs/simple-qrcode",
|
||||
"license" : "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Simple Software LLC",
|
||||
"email": "support@simplesoftware.io"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2|^8.0",
|
||||
"ext-gd": "*",
|
||||
"bacon/bacon-qr-code": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~1",
|
||||
"phpunit/phpunit": "~9"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-imagick": "Allows the generation of PNG QrCodes.",
|
||||
"illuminate/support": "Allows for use within Laravel."
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"SimpleSoftwareIO\\QrCode\\": "src"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "phpunit"
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"QrCode": "SimpleSoftwareIO\\QrCode\\Facades\\QrCode"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
417
vendor/simplesoftwareio/simple-qrcode/docs/de/README.md
vendored
Normal file
@@ -0,0 +1,417 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
#### [Deutsch](http://www.simplesoftware.io/#/docs/simple-qrcode/de) | [Español](http://www.simplesoftware.io/#/docs/simple-qrcode/es) | [Français](http://www.simplesoftware.io/#/docs/simple-qrcode/fr) | [Italiano](http://www.simplesoftware.io/#/docs/simple-qrcode/it) | [Português](http://www.simplesoftware.io/#/docs/simple-qrcode/pt-br) | [Русский](http://www.simplesoftware.io/#/docs/simple-qrcode/ru) | [日本語](http://www.simplesoftware.io/#/docs/simple-qrcode/ja) | [한국어](http://www.simplesoftware.io/#/docs/simple-qrcode/kr) | [हिंदी](http://www.simplesoftware.io/#/docs/simple-qrcode/hi) | [简体中文](http://www.simplesoftware.io/#/docs/simple-qrcode/zh-cn)
|
||||
|
||||
- [Einführung](#docs-introduction)
|
||||
- [Upgrade-Anleitung](#docs-upgrade)
|
||||
- [Installation](#docs-configuration)
|
||||
- [Einfache Anwendungsideen](#docs-ideas)
|
||||
- [Nutzungsbeispiele](#docs-usage)
|
||||
- [Helfer](#docs-helpers)
|
||||
- [Häufig verwendete QrCodes](#docs-common-usage)
|
||||
- [Verwendung außerhalb von Laravel](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## Einführung
|
||||
Simple QrCode stellt eine komfortable Schnittstelle zum Generieren von QrCodes für das beliebte Laravel Framework dar und basiert auf der großartigen Arbeit von [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). Das Paket ist einfach zu installieren und bietet ein Laravel-Nutzern vertrautes Nutzererlebnis.
|
||||
|
||||
 
|
||||
|
||||
<a id="docs-upgrade"></a>
|
||||
## Upgrade-Anleitung
|
||||
|
||||
Um von v2 auf v3 zu aktualisieren, muss die Versionsangabe der `simplesoftwareio/simple-qrcode` Abhängigkeit in der `composer.json` Datei auf `~4` geändert werden:
|
||||
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~4"
|
||||
}
|
||||
|
||||
Ein abschließender Aufruf von `composer update simplesoftwareio/simple-qrcode` aktualisiert das installierte Paket.
|
||||
|
||||
>Um das `png` Bildformat zu verwenden, **muss zwingend** die `imagick` PHP Extension installiert werden.
|
||||
|
||||
#### v4
|
||||
|
||||
Es gab einen Fehler im Bereich der Laravel Facades von v3, der einige Probleme beim Laden verursachte. Da die Problembehebung eine nicht abwärtskompatible Änderung nötig gemacht hat, wurde v4 veröffentlicht. Bei einem Upgrade von v2 muss kein Code angepasst werden; die nachfolgende Änderung betrifft nur Nutzer der v3.
|
||||
|
||||
Sämtliche Verweise auf die `QrCode` Facade müssen wie folgt geändert werden:
|
||||
|
||||
```
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
```
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## Installation
|
||||
|
||||
#### Composer
|
||||
|
||||
Das Paket kann durch Ausführung von `composer require simplesoftwareio/simple-qrcode "~4"` installiert werden.
|
||||
|
||||
Laravel wird das Paket automatisch integrieren.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## Einfache Anwendungsideen
|
||||
|
||||
#### Druckansicht
|
||||
|
||||
Wir verwenden das Package hauptsächlich dazu, QrCodes auf all unseren Druckansichten zu platzieren. So können unsere Kunden durch einfaches Scannen des QrCodes auf der ausgedruckten Seite zur Ursprungsseite zurückfinden. Erreicht haben wir das durch ein Hinzufügen der folgenden Zeilen in unserer footer.blade.php Datei:
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Scan mich, um zur Original-Seite zurückzukehren.</p>
|
||||
</div>
|
||||
|
||||
#### Einbetten eines QrCodes
|
||||
|
||||
Ein QrCode kann in eine E-Mail eingebettet werden, um den Nutzern ein schnelles Scannen zu ermöglichen. Das folgende Beispiel zeigt, wie man dies mit Laravel umsetzt:
|
||||
|
||||
// Innerhalb eines Blade Templates.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Bette mich in eine E-Mail ein!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## Nutzungsbeispiele
|
||||
|
||||
#### Grundfunktionen
|
||||
|
||||
```
|
||||
// Alle Beispiele gehen davon aus, dass die QrCode Facade über die untenstehende Code-Zeile eingebunden wird. Für Laravel Benutzer wird die Facade automatisch geladen.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
```
|
||||
|
||||
Die Verwendung des QrCode Generators ist sehr einfach. Die einfachste Art der Nutzung ist:
|
||||
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
|
||||
QrCode::generate('Wandel mich in einen QrCode!');
|
||||
|
||||
Dies wird einen QrCode mit dem Inhalt "Wandel mich in einen QrCode!" generieren.
|
||||
|
||||
#### Generate `(string $data, string $filename = null)`
|
||||
|
||||
`Generate` wird genutzt, um den QrCode zu generieren.
|
||||
|
||||
QrCode::generate('Wandel mich in einen QrCode!');
|
||||
|
||||
Standardmäßig liefert `generate` einen String mit SVG Daten zurück. Über Laravels Blade Template System kann dieser direkt in modernen Browsern angezeigt werden:
|
||||
|
||||
{!! QrCode::generate('Wandel mich in einen QrCode!'); !!}
|
||||
|
||||
Die `generate` Methode akzeptiert als zweiten Parameter einen Dateipfad zum Speichern des QrCodes in einer Zieldatei:
|
||||
|
||||
QrCode::generate('Wandel mich in einen QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### Format `(string $format)`
|
||||
|
||||
Es werden derzeit drei Bildformate unterstützt: `png`, `eps` und `svg`. Das gewünschte Format kann wie folgt gewählt werden:
|
||||
|
||||
QrCode::format('png'); // Wird ein png zurückliefern
|
||||
QrCode::format('eps'); // Wird ein eps zurückliefern
|
||||
QrCode::format('svg'); // Wird ein svg zurückliefern
|
||||
|
||||
> `imagick` wird benötigt, um ein `png` zu generieren.
|
||||
|
||||
#### Size `(int $size)`
|
||||
|
||||
Die gewünschte Größe des QrCodes kann über die `size` Methode festgelegt werden. Dazu wird einfach die gewünschte Größe in Pixel übergeben:
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
 
|
||||
|
||||
#### Color `(int $red, int $green, int $blue, int $alpha = null)`
|
||||
|
||||
>Vorsicht beim Ändern der Farbe eines QrCodes: einige QrCode-Leser haben große Schwierigkeiten, farbige QrCodes zu lesen.
|
||||
|
||||
Alle Farben werden im RGBA (Rot, Grün, Blau, Alpha) Format angegeben. Die Farbe eines QrCodes kann wie folgt geändert werden:
|
||||
|
||||
QrCode::color(255, 0, 0); // Roter QrCode
|
||||
QrCode::color(255, 0, 0, 25); // Roter QrCode mit 25% Transparenz
|
||||
|
||||
 
|
||||
|
||||
#### Background Color `(int $red, int $green, int $blue, int $alpha = null)`
|
||||
|
||||
Die Hintergrundfarbe eines QrCodes kann über die `backgroundColor` Methode geändert werden.
|
||||
|
||||
QrCode::backgroundColor(255, 0, 0); // QrCode mit rotem Hintergrund
|
||||
QrCode::backgroundColor(255, 0, 0, 25); // QrCode mit rotem Hintergrund und 25% Transparenz
|
||||
|
||||
 
|
||||
|
||||
#### Gradient `$startRed, $startGreen, $startBlue, $endRed, $endGreen, $endBlue, string $type)`
|
||||
|
||||
Einem QrCode kann über die `gradient` Methode ein Farbverlauf zugewiesen werden.
|
||||
|
||||
Die folgenden Typen von Gradienten werden unterstützt:
|
||||
|
||||
| Typ | Beispiel |
|
||||
| --- | --- |
|
||||
| `vertical` |  |
|
||||
| `horizontal` |  |
|
||||
| `diagonal` |  |
|
||||
| `inverse_diagonal` |  |
|
||||
| `radial` |  |
|
||||
|
||||
#### EyeColor `(int $eyeNumber, int $innerRed, int $innerGreen, int $innerBlue, int $outterRed = 0, int $outterGreen = 0, int $outterBlue = 0)`
|
||||
|
||||
Die Farben der Positionsmarker können über die `eyeColor` Methode angepasst werden.
|
||||
|
||||
| Auge Nr. | Beispiel |
|
||||
| --- | --- |
|
||||
| `0` |  |
|
||||
| `1` | |
|
||||
| `2` |  |
|
||||
|
||||
|
||||
#### Style `(string $style, float $size = 0.5)`
|
||||
|
||||
Über `square` (quadratisch), `dot` (punktförmig), oder `round` (rund) kann der Stil einfach ausgetauscht werden. Dies ändert die Datenblöcke innerhalb des QrCodes. Der zweite Parameter bestimmt die Größe der einzelnen Punkte oder deren Abrundung.
|
||||
|
||||
| Stil | Beispiel |
|
||||
| --- | --- |
|
||||
| `square` |  |
|
||||
| `dot` | |
|
||||
| `round` |  |
|
||||
|
||||
#### Eye Style `(string $style)`
|
||||
|
||||
Es werden zwei verschiedene Stile von Positionsmarkern unterstützt: `square` (quadratisch) und `circle` (rund).
|
||||
|
||||
| Style | Example |
|
||||
| --- | --- |
|
||||
| `square` |  |
|
||||
| `circle` | |
|
||||
|
||||
#### Margin `(int $margin)`
|
||||
|
||||
Der Seitenrand des QrCodes kann über die folgende Syntax festgelegt werden:
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### Error Correction `(string $errorCorrection)`
|
||||
|
||||
Über die `errorCorrection` Methode kann der anzuwendende Grad der Fehlerkorrektur einfach geändert werden:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
Die folgenden Optionen werden von der Methode unterstützt:
|
||||
|
||||
| Fehlerkorrekturstufe | Gewährleistete Sicherheit |
|
||||
| --- | --- |
|
||||
| L | 7% der Daten können wiederhergestellt werden. |
|
||||
| M | 15% der Daten können wiederhergestellt werden. |
|
||||
| Q | 25% der Daten können wiederhergestellt werden. |
|
||||
| H | 30% of der Daten können wiederhergestellt werden. |
|
||||
|
||||
>Je hoher die Fehlerkorrekturstufe, desto größer wird der resultierende QrCode und desto weniger Daten können in ihm gespeichert werden. Mehr Informationen zur [Fehlerkorrektur](http://de.wikipedia.org/wiki/QR_code#Error_correction) finden sich in der Wikipedia.
|
||||
|
||||
#### Encoding `(string $encoding)`
|
||||
|
||||
Über die `encoding` Methode kann die für den QrCode verwendete Zeichenkodierung bestimmt werden. Standardmäßig wird `ISO-8859-1` verwendet. Mehr zur [Zeichenkodierung](https://de.wikipedia.org/wiki/Zeichenkodierung) findet sich in der Wikipedia.
|
||||
|
||||
Die folgenden Kodierungen werden unterstützt:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Generier mir einen QrCode mit Symbolen ♠♥!!');
|
||||
|
||||
| Zeichenkodierung |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
#### Merge `(string $filepath, float $percentage = .2, bool $absolute = false)`
|
||||
|
||||
Die `merge` Methode passt ein Bild in einen QrCode ein. Üblicherweise wird dies verwendet, um ein Logo in einem QrCode anzuzeigen.
|
||||
|
||||
// Generiert einen QrCode mit einem mittig zentrierten Bild.
|
||||
QrCode::format('png')->merge('pfad-zur-bilddatei.png')->generate();
|
||||
|
||||
// Generiert einen QrCode mit einem mittig zentrierten Bild. Das Bild nimmt dabei 30% des QrCodes ein.
|
||||
QrCode::format('png')->merge('pfad-zur-bilddatei.png', .3)->generate();
|
||||
|
||||
// Generiert einen QrCode mit einem mittig zentrierten Bild. Das Bild nimmt dabei 30% des QrCodes ein.
|
||||
QrCode::format('png')->merge('http://www.google.com/irgendeinbild.png', .3, true)->generate();
|
||||
|
||||
>Die `merge` Methode unterstützt derzeit ausschließlich Bilder im PNG Format.
|
||||
>Der Dateipfad muss relativ zum Basispfad der App angegeben werden, solange `$absolute` auf `false` gesetzt ist. Ein absoluter Dateipfad wird erwartet, wenn der Parameter auf `true` gesetzt wird.
|
||||
|
||||
>Bei Verwendung der `merge` Methode sollte eine hohe Fehlerkorrekturstufe gewählt werden, um sicherzustellen, dass der QrCode lesbar bleibt. Wir empfehlen eine Nutzung von `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
#### Merge Binary String `(string $content, float $percentage = .2)`
|
||||
|
||||
Die `mergeString` Methode entspricht der `merge` Methode, erlaubt aber abweichend den Inhalt einer Bilddatei als String zu übergeben. Dies ist besonders hilfreich, wenn mit der `Storage` Facade gearbeitet wird.
|
||||
|
||||
// Generiert einen QrCode mit einem mittig zentrierten Bild.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
|
||||
|
||||
// Generiert einen QrCode mit einem mittig zentrierten Bild. Das Bild nimmt dabei 30% des QrCodes ein.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
|
||||
|
||||
>Wie auch bei `merge` werden derzeit nur Daten im PNG Format unterstützt. Ebenso wird auch hier die Verwendung einer hohen Fehlerkorrekturstufe empfohlen.
|
||||
|
||||
#### Fortgeschrittene Nutzung
|
||||
|
||||
Alle Methoden können verkettet werden. Dabei muss die `generate` Methode jeweils als letztes aufgerufen werden. So sind beispielsweise die folgenden Aufrufe möglich:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Generier einen QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Generier einen QrCode!');
|
||||
|
||||
Durch Umwandlung der als String zurückgelieferten binären Bilddaten über `base64_encode` kann der QrCode als PNG Bild angezeigt werden, ohne dieses vorher in einer Datei speichern zu müssen:
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Generier einen QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## Helfer
|
||||
|
||||
#### Was sind Helfer?
|
||||
|
||||
Helfer stellen einen einfachen Weg war, QrCodes zu generieren, die einen QrCode-Leser anweisen, nach dem Scannen eine bestimmte Aktion auszuführen.
|
||||
|
||||
#### BitCoin
|
||||
|
||||
Dieser Helfer generiert einen QrCode, um BitCoin-Zahlungen anzuweisen. [Weitere Informationen](https://bitco.in/en/developer-guide#plain-text) dazu (in Englisch).
|
||||
|
||||
QrCode::BTC($adresse, $betrag);
|
||||
|
||||
// Weist eine Zahlung über 0.334BTC an die angegebene Adresse an.
|
||||
QrCode::BTC('bitcoin adresse', 0.334);
|
||||
|
||||
// Sendet eine Zahlung über 0.334BTC an die Adresse mit zusätzlichen optionalen Parametern.
|
||||
QrCode::size(500)->BTC('adresse', 0.0034, [
|
||||
'label' => 'Meine Kennzeichnung',
|
||||
'message' => 'Meine Nachricht',
|
||||
'returnAddress' => 'https://www.rueckkehrurl.com'
|
||||
]);
|
||||
|
||||
#### E-Mail
|
||||
|
||||
Dieser Helfer generiert einen E-Mail QrCode, der automatisch die Zieladresse, Betreff und einen Text im E-Mail-Programm befüllt:
|
||||
|
||||
QrCode::email($an, $betreff, $nachricht);
|
||||
|
||||
// Füllt die Zieladresse aus.
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
// Füllt die Zieladresse, das Betreff und die Nachricht einer E-Mail aus.
|
||||
QrCode::email('foo@bar.com', 'Dies ist das Betreff.', 'Dies ist die Nachricht.');
|
||||
|
||||
// Füllt nur Betreff und Nachricht aus.
|
||||
QrCode::email(null, ''Dies ist das Betreff.', 'Dies ist die Nachricht.');
|
||||
|
||||
#### Geo
|
||||
|
||||
Dieser Helfer generiert einen QrCode mit Positionsinformationen über Angabe eines Breiten- und Längengrads, die ein Smartphone lesen und in Google Maps oder einer ähnlichen App darstellen kann.
|
||||
|
||||
QrCode::geo($breitengrad, $laengengrad);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### Telefonnummer
|
||||
|
||||
Dieser Helfer generiert einen QrCode, der den QrCode-Leser anweist, eine Telefonnummer anzuwählen.
|
||||
|
||||
QrCode::phoneNumber($telefonNummer);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### SMS Nachrichten
|
||||
|
||||
Über diesen Helfer können Nachrichten in der SMS App vorab mit der Nummer und dem Text ausgefüllt werden:
|
||||
|
||||
QrCode::SMS($telefonNummer, $nachricht);
|
||||
|
||||
// Generiert eine leere SMS mit vorbefüllter Telefonnummer.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
// Generiert eine SMS mit vorbefüllter Telefonnummer und Nachricht.
|
||||
QrCode::SMS('555-555-5555', 'Nachricht');
|
||||
|
||||
#### WiFi
|
||||
|
||||
Dieser Helper generiert QrCodes, die gescannt werden können um ein Mobilgerät mit einem Drahtlosnetzwerk zu verbinden:
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID des Netzwerks',
|
||||
'password' => 'Passwort des Netzwerks',
|
||||
'hidden' => 'Bestimmt ob die SSID des Netzwerks versteckt ist oder nicht.'
|
||||
]);
|
||||
|
||||
// Verbindet zu einem offenen Drahtlosnetzwerk.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Netzwerkname',
|
||||
]);
|
||||
|
||||
// Verbindet zu einem offenen Drahtlosnetzwerk mit geheimer SSID.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Netzwerkname',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
// Verbindet zu einem gesicherten Drahtlosnetzwerk mit WPA Verschlüsselung.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nerzwerkname',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'Netzwerkpasswort'
|
||||
]);
|
||||
|
||||
>WiFi QrCodes werden aktuell nicht von Apple-Produkten unterstützt.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
## Häufig verwendete QrCodes
|
||||
|
||||
Dem Inhaltsparameter der `generate` Methode kann ein Präfix vorangestellt werden, um auf schnelle Weise einen QrCode mit komplexeren Informationen zu generieren:
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| Verwendung | Präfix | Beispiel |
|
||||
| --- | --- | --- |
|
||||
| Webseiten URL | http:// | http://www.simplesoftware.io |
|
||||
| Sichere URL | https:// | https://www.simplesoftware.io |
|
||||
| E-mail Adresse | mailto: | mailto:support@simplesoftware.io |
|
||||
| Telefonnummer | tel: | tel:555-555-5555 |
|
||||
| SMS | sms: | sms:555-555-5555 |
|
||||
| SMS mit vorbefüllter Nachricht | sms: | sms::Ich bin eine vorbefüllte Nachricht |
|
||||
| SMS mit vorbefüllter Nachricht und Nummer | sms: | sms:555-555-5555:Ich bin eine vorbefüllte Nachricht |
|
||||
| Geo-Position | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Eine Adresse, Irgendwo, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [Beispiele auf Wikipedia](https://de.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Versteckt(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
## Verwendung außerhalb von Laravel
|
||||
|
||||
Dieses Paket kann auch ohne Laravel verwendet werden, indem man eine neue Instanz der `Generator` Klasse erzeugt.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\Generator;
|
||||
|
||||
$qrcode = new Generator;
|
||||
$qrcode->size(500)->generate('Generiere einen QrCode ohne Laravel!');
|
||||
428
vendor/simplesoftwareio/simple-qrcode/docs/en/README.md
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
#### [Deutsch](http://www.simplesoftware.io/#/docs/simple-qrcode/de) | [Español](http://www.simplesoftware.io/#/docs/simple-qrcode/es) | [Français](http://www.simplesoftware.io/#/docs/simple-qrcode/fr) | [Italiano](http://www.simplesoftware.io/#/docs/simple-qrcode/it) | [Português](http://www.simplesoftware.io/#/docs/simple-qrcode/pt-br) | [Русский](http://www.simplesoftware.io/#/docs/simple-qrcode/ru) | [日本語](http://www.simplesoftware.io/#/docs/simple-qrcode/ja) | [한국어](http://www.simplesoftware.io/#/docs/simple-qrcode/kr) | [हिंदी](http://www.simplesoftware.io/#/docs/simple-qrcode/hi) | [简体中文](http://www.simplesoftware.io/#/docs/simple-qrcode/zh-cn)
|
||||
|
||||
## Try our dead simple, free file transfer service [keep.sh](https://keep.sh)
|
||||
|
||||
[](https://keep.sh)
|
||||
|
||||
Upload files with a single curl command from your terminal! `curl --upload-file file.txt https://keep.sh`
|
||||
|
||||
## Use Cases
|
||||
<p align="center">
|
||||
<a href="https://www.rsvpify.com">
|
||||
<img width="300" src="https://rsvpify.com/wp-content/uploads/2017/03/rsvpify-logo-header-rsvp.png">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://rsvpify.com/sell-tickets">Platform to sell tickets online</a>
|
||||
</p>
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## Introduction
|
||||
Simple QrCode is an easy to use wrapper for the popular Laravel framework based on the great work provided by [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). We created an interface that is familiar and easy to install for Laravel users.
|
||||
|
||||
 
|
||||
|
||||
<a id="docs-upgrade"></a>
|
||||
## Upgrade Guide
|
||||
|
||||
Upgrade from v2 or v3 by changing your `composer.json` file to `~4`
|
||||
|
||||
You **must** install the `imagick` PHP extension if you plan on using the `png` image format.
|
||||
|
||||
#### v4
|
||||
|
||||
> There was a mistake when creating 4.1.0 and allowing a backwards breaking change into the master branch. The `generate` method will now return an instance of `Illuminate\Support\HtmlString` if you are running Laravel. See https://github.com/SimpleSoftwareIO/simple-qrcode/issues/205 for more information.
|
||||
|
||||
There was a Laravel facade issue within v3 that causes some loading issues. The only way to fix this was to create a backwards breaking change so v4 has been released. If you are coming from v2 there is no need to change any code. The below change only effects users on v3.
|
||||
|
||||
All references to the `QrCode` facade need to be changed to:
|
||||
|
||||
```
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
```
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## Configuration
|
||||
|
||||
#### Composer
|
||||
|
||||
Run `composer require simplesoftwareio/simple-qrcode "~4"` to add the package.
|
||||
|
||||
Laravel will automatically pick up and install the package.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## Simple Ideas
|
||||
|
||||
#### Print View
|
||||
|
||||
One of the main items that we use this package for is to have QrCodes in all of our print views. This allows our customers to return to the original page after it is printed by simply scanning the code. We achieved this by adding the following into our footer.blade.php file:
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Scan me to return to the original page.</p>
|
||||
</div>
|
||||
|
||||
#### Embed A QrCode
|
||||
|
||||
You may embed a qrcode inside of an e-mail to allow your users to quickly scan. The following is an example of how to do this with Laravel:
|
||||
|
||||
//Inside of a blade template.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Embed me into an e-mail!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## Usage
|
||||
|
||||
#### Basic Usage
|
||||
|
||||
```
|
||||
// All examples below assume you are pulling in the QrCode facade with the following line of code. The Facade is auto-loaded for Laravel users.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
```
|
||||
|
||||
Using the QrCode Generator is very easy. The most basic syntax is:
|
||||
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
This will make a QrCode that says "Make me into a QrCode!"
|
||||
|
||||

|
||||
|
||||
#### Generate `(string $data, string $filename = null)`
|
||||
|
||||
`Generate` is used to make the QrCode.
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
`Generate` by default will return a SVG image string. You can print this directly into a modern browser within Laravel's Blade system with the following:
|
||||
|
||||
{!! QrCode::generate('Make me into a QrCode!'); !!}
|
||||
|
||||
The `generate` method has a second parameter that will accept a filename and path to save the QrCode.
|
||||
|
||||
QrCode::generate('Make me into a QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### Format `(string $format)`
|
||||
|
||||
Three formats are currently supported; `png,` `eps,` and `svg`. To change the format use the following code:
|
||||
|
||||
QrCode::format('png'); //Will return a png image
|
||||
QrCode::format('eps'); //Will return a eps image
|
||||
QrCode::format('svg'); //Will return a svg image
|
||||
|
||||
> `imagick` is required in order to generate a `png` image.
|
||||
|
||||
#### Size `(int $size)`
|
||||
|
||||
You can change the size of a QrCode by using the `size` method. Simply specify the size desired in pixels using the following syntax:
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
 
|
||||
|
||||
#### Color `(int $red, int $green, int $blue, int $alpha = null)`
|
||||
|
||||
>Be careful when changing the color of a QrCode, as some readers have a very difficult time reading QrCodes in color.
|
||||
|
||||
All colors must be expressed in RGBA (Red Green Blue Alpha). You can change the color of a QrCode by using the following:
|
||||
|
||||
QrCode::color(255, 0, 0); // Red QrCode
|
||||
QrCode::color(255, 0, 0, 25); //Red QrCode with 25% transparency
|
||||
|
||||
 
|
||||
|
||||
#### Background Color `(int $red, int $green, int $blue, int $alpha = null)`
|
||||
|
||||
You can change the background color of a QrCode by calling the `backgroundColor` method.
|
||||
|
||||
QrCode::backgroundColor(255, 0, 0); // Red background QrCode
|
||||
QrCode::backgroundColor(255, 0, 0, 25); //Red background QrCode with 25% transparency
|
||||
|
||||
 
|
||||
|
||||
#### Gradient `$startRed, $startGreen, $startBlue, $endRed, $endGreen, $endBlue, string $type)`
|
||||
|
||||
You can apply a gradient to the QrCode by calling the `gradient` method.
|
||||
|
||||
The following gradient types are supported:
|
||||
|
||||
| Type | Example |
|
||||
| --- | --- |
|
||||
| `vertical` |  |
|
||||
| `horizontal` |  |
|
||||
| `diagonal` |  |
|
||||
| `inverse_diagonal` |  |
|
||||
| `radial` |  |
|
||||
|
||||
#### EyeColor `(int $eyeNumber, int $innerRed, int $innerGreen, int $innerBlue, int $outterRed = 0, int $outterGreen = 0, int $outterBlue = 0)`
|
||||
|
||||
You may change the eye colors by using the `eyeColor` method.
|
||||
|
||||
QrCode::eyeColor(0, 255, 255, 255, 0, 0, 0); // Changes the eye color of eye `0`
|
||||
|
||||
| Eye Number | Example |
|
||||
| --- | --- |
|
||||
| `0` |  |
|
||||
| `1` | |
|
||||
| `2` |  |
|
||||
|
||||
|
||||
#### Style `(string $style, float $size = 0.5)`
|
||||
|
||||
The style can be easily swapped out with `square`, `dot,` or `round`. This will change the blocks within the QrCode. The second parameter will affect the size of the dots or roundness.
|
||||
|
||||
QrCode::style('dot'); // Uses the `dot` style.
|
||||
|
||||
| Style | Example |
|
||||
| --- | --- |
|
||||
| `square` |  |
|
||||
| `dot` | |
|
||||
| `round` |  |
|
||||
|
||||
#### Eye Style `(string $style)`
|
||||
|
||||
The eye within the QrCode supports two different styles, `square` and `circle`.
|
||||
|
||||
QrCode::eye('circle'); // Uses the `circle` style eye.
|
||||
|
||||
| Style | Example |
|
||||
| --- | --- |
|
||||
| `square` |  |
|
||||
| `circle` | |
|
||||
|
||||
#### Margin `(int $margin)`
|
||||
|
||||
The ability to change the margin around a QrCode is also supported. Simply specify the desired margin using the following syntax:
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### Error Correction `(string $errorCorrection)`
|
||||
|
||||
Changing the level of error correction is easy. Just use the following syntax:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
The following are supported options for the `errorCorrection` method:
|
||||
|
||||
| Error Correction | Assurance Provided |
|
||||
| --- | --- |
|
||||
| L | 7% of codewords can be restored. |
|
||||
| M | 15% of codewords can be restored. |
|
||||
| Q | 25% of codewords can be restored. |
|
||||
| H | 30% of codewords can be restored. |
|
||||
|
||||
>The more error correction used; the bigger the QrCode becomes and the less data it can store. Read more about [error correction](http://en.wikipedia.org/wiki/QR_code#Error_correction).
|
||||
|
||||
#### Encoding `(string $encoding)`
|
||||
|
||||
Change the character encoding that is used to build a QrCode. By default `ISO-8859-1` is selected as the encoder. Read more about [character encoding](http://en.wikipedia.org/wiki/Character_encoding).
|
||||
|
||||
You can change this to any of the following:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Make me a QrCode with special symbols ♠♥!!');
|
||||
|
||||
| Character Encoder |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
#### Merge `(string $filepath, float $percentage = .2, bool $absolute = false)`
|
||||
|
||||
The `merge` method merges an image over a QrCode. This is commonly used to placed logos within a QrCode.
|
||||
|
||||
//Generates a QrCode with an image centered in the middle.
|
||||
QrCode::format('png')->merge('path-to-image.png')->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
|
||||
>The `merge` method only supports PNG at this time.
|
||||
>The filepath is relative to app base path if `$absolute` is set to `false`. Change this variable to `true` to use absolute paths.
|
||||
|
||||
>You should use a high level of error correction when using the `merge` method to ensure that the QrCode is still readable. We recommend using `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
#### Merge Binary String `(string $content, float $percentage = .2)`
|
||||
|
||||
The `mergeString` method can be used to achieve the same as the `merge` call, except it allows you to provide a string representation of the file instead of the filepath. This is usefull when working with the `Storage` facade. It's interface is quite similar to the `merge` call.
|
||||
|
||||
//Generates a QrCode with an image centered in the middle.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
|
||||
|
||||
>As with the normal `merge` call, only PNG is supported at this time. The same applies for error correction, high levels are recommened.
|
||||
|
||||
#### Advance Usage
|
||||
|
||||
All methods support chaining. The `generate` method must be called last. For example you could run any of the following:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Make me a QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Make me a QrCode!');
|
||||
|
||||
You can display a PNG image without saving the file by providing a raw string and encoding with `base64_encode`.
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Make me into an QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## Helpers
|
||||
|
||||
#### What are helpers?
|
||||
|
||||
Helpers are an easy way to create QrCodes that cause a reader to perform a certain action when scanned.
|
||||
|
||||
#### BitCoin
|
||||
|
||||
This helper generates a scannable bitcoin to send payments. [More information](https://bitco.in/en/developer-guide#plain-text)
|
||||
|
||||
QrCode::BTC($address, $amount);
|
||||
|
||||
//Sends a 0.334BTC payment to the address
|
||||
QrCode::BTC('bitcoin address', 0.334);
|
||||
|
||||
//Sends a 0.334BTC payment to the address with some optional arguments
|
||||
QrCode::size(500)->BTC('address', 0.0034, [
|
||||
'label' => 'my label',
|
||||
'message' => 'my message',
|
||||
'returnAddress' => 'https://www.returnaddress.com'
|
||||
]);
|
||||
|
||||
#### E-Mail
|
||||
|
||||
This helper generates an e-mail qrcode that is able to fill in the e-mail address, subject, and body:
|
||||
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
//Fills in the to address
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
//Fills in the to address, subject, and body of an e-mail.
|
||||
QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');
|
||||
|
||||
//Fills in just the subject and body of an e-mail.
|
||||
QrCode::email(null, 'This is the subject.', 'This is the message body.');
|
||||
|
||||
#### Geo
|
||||
|
||||
This helper generates a latitude and longitude that a phone can read and opens the location in Google Maps or similar app.
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### Phone Number
|
||||
|
||||
This helper generates a QrCode that can be scanned and then dials a number.
|
||||
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### SMS (Text Messages)
|
||||
|
||||
This helper makes SMS messages that can be prefilled with the send to address and body of the message:
|
||||
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
//Creates a text message with the number filled in.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
//Creates a text message with the number and message filled in.
|
||||
QrCode::SMS('555-555-5555', 'Body of the message');
|
||||
|
||||
#### WiFi
|
||||
|
||||
This helpers makes scannable QrCodes that can connect a phone to a WiFi network:
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID of the network',
|
||||
'password' => 'Password of the network',
|
||||
'hidden' => 'Whether the network is a hidden SSID or not.'
|
||||
]);
|
||||
|
||||
//Connects to an open WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
]);
|
||||
|
||||
//Connects to an open, hidden WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
//Connects to a secured WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'myPassword'
|
||||
]);
|
||||
|
||||
>WiFi scanning is not currently supported on Apple Products.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
## Common QrCode Usage
|
||||
|
||||
You can use a prefix found in the table below inside the `generate` section to create a QrCode to store more advanced information:
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| Usage | Prefix | Example |
|
||||
| --- | --- | --- |
|
||||
| Website URL | http:// | http://www.simplesoftware.io |
|
||||
| Secured URL | https:// | https://www.simplesoftware.io |
|
||||
| E-mail Address | mailto: | mailto:support@simplesoftware.io |
|
||||
| Phone Number | tel: | tel:555-555-5555 |
|
||||
| Text (SMS) | sms: | sms:555-555-5555 |
|
||||
| Text (SMS) With Pretyped Message | sms: | sms::I am a pretyped message |
|
||||
| Text (SMS) With Pretyped Message and Number | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| Geo Address | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
## Usage Outside of Laravel
|
||||
|
||||
You may use this package outside of Laravel by instantiating a new `Generator` class.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\Generator;
|
||||
|
||||
$qrcode = new Generator;
|
||||
$qrcode->size(500)->generate('Make a qrcode without Laravel!');
|
||||
341
vendor/simplesoftwareio/simple-qrcode/docs/es/README.md
vendored
Normal file
@@ -0,0 +1,341 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
|
||||
- [Introducción](#docs-introduction)
|
||||
- [Traducciones](#docs-translations)
|
||||
- [Configuración](#docs-configuration)
|
||||
- [Ideas Simples](#docs-ideas)
|
||||
- [Uso](#docs-usage)
|
||||
- [Helpers](#docs-helpers)
|
||||
- [Uso Común de QrCode](#docs-common-usage)
|
||||
- [Uso fuera de Laravel](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## Introducción
|
||||
Simple QrCode es un empaquetador de fácil uso para el popular framework Laravel basado en el gran trabajo proporcionado por [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). Hemos creado una interfaz que es familiar y fácil de usar para los usuarios de Laravel.
|
||||
|
||||
<a id="docs-translations"></a>
|
||||
## Traducciones
|
||||
Estamos buscando usuarios que hablen Árabe, Francés, Coreano o Japonés para traducir este documento. Porfavor cread una pull request si podeis ayudar con una traducción!
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## Configuración
|
||||
|
||||
#### Composer
|
||||
|
||||
Primero, añadir el paquete Simple QrCode en su `require` en su archivo `composer.json`:
|
||||
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~2"
|
||||
}
|
||||
|
||||
Luego, ejecutar el comando `composer update`.
|
||||
|
||||
#### Service Provider
|
||||
|
||||
###### Laravel <= 5.4
|
||||
Registrar `SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class` en su `config/app.php` dentro del array `providers`.
|
||||
|
||||
#### Aliases
|
||||
|
||||
###### Laravel <= 5.4
|
||||
Finalmente, registrar `'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class` en su archivo de configuración `config/app.php` dentro del array `aliases`.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## Ideas Simples
|
||||
|
||||
#### Print View
|
||||
|
||||
Uno de los principales usos de este paquete es la posibilidad de disponer QrCodes en todas nuestras print views. Esto permite a nuestros usuarios volver a la página original después de imprimir simplemente escaneando el código. Todo esto es posible añadiendo lo siguiente en nuestro archivo `footer.blade.php´.
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Escanéame para volver a la página principal.</p>
|
||||
</div>
|
||||
|
||||
#### Incorporar un QrCode
|
||||
|
||||
Puedes incorporar un código Qr en un e-mail para permitir a los usuarios un ágil escaneo. El ejemplo siguiente muestra como hacer esto con Laravel.
|
||||
|
||||
//Inside of a blade template.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Incorpórame en un e-mail!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## Uso
|
||||
|
||||
#### Uso Básico
|
||||
|
||||
Usar el QrCode Generator es muy simple. La sintaxis más básica es:
|
||||
|
||||
QrCode::generate('Transfórmame en un QrCode!');
|
||||
|
||||
Esto creara un código que diga "Transfórmame en un QrCode!"
|
||||
|
||||
#### Generate
|
||||
|
||||
`Generate` se usa para crear el QrCode.
|
||||
|
||||
QrCode::generate('Transfórmame en un QrCode!');
|
||||
|
||||
>Atención! Este método debe de ser usado el último si se usa dentro de una cadena de comandos (chain).
|
||||
|
||||
`Generate` por defecto devolverá un string de una imagen SVG. Puedes imprimirla directamente en un navegador moderno con el sistema Blade de Laravel con el siguiente código:
|
||||
|
||||
{!! QrCode::generate('Transfórmame en un QrCode!'); !!}
|
||||
|
||||
El método `generate` tiene un segundo parámetro que aceptará un nombre de archivo y un directorio para guardar el QrCode.
|
||||
|
||||
QrCode::generate('Transfórmame en un QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### Cambio de Formato
|
||||
|
||||
>QrCode Generator por defecto devolverá una imagen SVG.
|
||||
|
||||
>Atención! El método `format` tiene que ser usado antes que cualquier opción de formato como `size`, `color`, `backgroundColor`, o `margin`.
|
||||
|
||||
Actualmente hay 3 formatos compatibles; PNG, EPS, and SVG. Para cambiar el formato usa el siguiente código:
|
||||
|
||||
QrCode::format('png'); //Devolvera una imagen PNG
|
||||
QrCode::format('eps'); //Devolvera una imagen EPS
|
||||
QrCode::format('svg'); //Devolvera una imagen SVG
|
||||
|
||||
#### Cambio de Tamaño
|
||||
|
||||
>QrCode Generator devolverá por defecto el tamaño de píxels mínimo para crear el QrCode.
|
||||
|
||||
Puedes cambiar el tamaño de un QrCode usando el método `size`. Simplemente especifica el tamaño deseado en píxels usando el siguiente código:
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
#### Cambio de Color
|
||||
|
||||
>Presta atención al cambiar el color de un QrCode. Algunos lectores tienen dificultades al leer QrCodes en color.
|
||||
|
||||
Todos los colores deben ser expresados en RGB (Red Green Blue). Puedes cambiar el color del QrCode usando el siguiente código:
|
||||
|
||||
QrCode::color(255,0,255);
|
||||
|
||||
Para cambiar el color del fondo usamos:
|
||||
|
||||
QrCode::backgroundColor(255,255,0);
|
||||
|
||||
#### Cambio de Márgenes
|
||||
|
||||
Es posible cambiar el márgen alrededor del QrCode. Simplemente especificamos el márgen deseado usando el siguiente código:
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### Corrección de Errores
|
||||
|
||||
Cambiar el nivel de corrección de errores es fácil. Unicamente usa el siguiente código:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
Las siguientes opciónes son compatibles con el método de `errorCorrection`.
|
||||
|
||||
| Error Correction | Assurance Provided |
|
||||
| --- | --- |
|
||||
| L | 7% of codewords can be restored. |
|
||||
| M | 15% of codewords can be restored. |
|
||||
| Q | 25% of codewords can be restored. |
|
||||
| H | 30% of codewords can be restored. |
|
||||
|
||||
>Cuanto más corrección de error se usa; el QrCode aumenta y puede almacenar menos datos. Para saber más sobre [corrección de error](http://en.wikipedia.org/wiki/QR_code#Error_correction).
|
||||
|
||||
#### Encoding
|
||||
|
||||
Para cambiar la codificación de carácteres que se usa para crear un QrCode. Por defecto `ISO-8859-1` está seleccionado. Para saber más sobre [codificación de carácteres](http://en.wikipedia.org/wiki/Character_encoding) You can change this to any of the following:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Transfórmame en un QrCode con símbolos especiales ♠♥!!');
|
||||
|
||||
| Codificador de carácteres |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
>Un error de `Could not encode content to ISO-8859-1` significa que se esta usando una codificación de carácteres incorrecta. Recomendamos `UTF-8` si no está seguro.
|
||||
|
||||
#### Merge
|
||||
|
||||
El método `merge` une una imagen con un QrCode. Normalmente se usa para añadir logos en un QrCode.
|
||||
|
||||
QrCode::merge($filename, $percentage, $absolute);
|
||||
|
||||
//Genera un QrCode con una imagen en el centro.
|
||||
QrCode::format('png')->merge('path-to-image.png')->generate();
|
||||
|
||||
//Genera un QrCode con una imagen en el centro. La imagen ocupa un 30% del QrCode.
|
||||
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
|
||||
|
||||
//Genera un QrCode con una imagen en el centro. La imagen ocupa un 30% del QrCode.
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
|
||||
>El método `merge` sólo es compatible con PNG de momento.
|
||||
>El path del archivo es relativo al path de la app si `$absolute` equivale a `false`. Cambia esta variable a `true` para usar paths absolutos.
|
||||
|
||||
>Se debería usar un nivel alto de corrección de error al usar `merge` para asegurarse que el QrCode se sigue podiendo leer. Recomendamos usar `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
#### Merge Binary String
|
||||
|
||||
El método `mergeString` se puede usar para conseguir el mismo resultado que con `merge`, con la diferencia que permite proveer una representación en string del archivo en vez de el filepath. Ésto es útil al trabajar con el `Storage` facade. Su interfaz es muy similar a la de `merge`.
|
||||
|
||||
QrCode::mergeString(Storage::get('path/to/image.png'), $percentage);
|
||||
|
||||
//Genera un QrCode con una imagen en el centro.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
|
||||
|
||||
//Genera un QrCode con una imagen en el centro. La imagen ocupa un 30% del QrCode.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
|
||||
|
||||
>Igual que con `merge`, sólo PNG de momento. Lo mismo que con el nivel de corrección de error, alto nivel está recomendado.
|
||||
|
||||
#### Uso Avanzado
|
||||
|
||||
Todos los métodos soportan chaining. El método `generate` tiene que ser el último y cualquier cambio de `format` tiene que ser llamado primero. Por ejemplo:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Transfórmame en un QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Transfórmame en un QrCode!');
|
||||
|
||||
Puedes mostrar una imagen PNG sin guardar el archivo usando una string y eligiendo la codificación `base64_encode`.
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Transfórmame en un QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## Helpers
|
||||
|
||||
#### Qué son los helpers?
|
||||
|
||||
Los helpers son una manera fácil de crear QrCodes que causan que causan una acción en el lector al escanear.
|
||||
|
||||
#### E-Mail
|
||||
|
||||
Este helper genera un QrCode de e-mail que es capaz de rellenar dirección e-mail, asunto, y el cuerpo del e-mail.
|
||||
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
//Rellena la dirección
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
//Rellena la dirección, el asunto y el cuerpo.
|
||||
QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');
|
||||
|
||||
//Solo rellena el asunto y el cuerpo del e-mail.
|
||||
QrCode::email(null, 'This is the subject.', 'This is the message body.');
|
||||
|
||||
#### Geo
|
||||
|
||||
Este helper genera una latitude y una longitude que un teléfono puede leer y abrir la localización en Google Maps o alguna app similar.
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### Phone Number
|
||||
|
||||
Este helper genera un QrCode que puede ser escaneado y llama a un número de teléfono.
|
||||
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### SMS (Mensajes de texto)
|
||||
|
||||
Este helper crea SMS que pueden ser previamente rellenados con la dirección y el mensaje.
|
||||
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
//Crea un mensaje de texto con el número rellenado.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
//Crea un mensaje de texto con el número y el mensaje rellenados.
|
||||
QrCode::SMS('555-555-5555', 'Mensaje');
|
||||
|
||||
#### WiFi
|
||||
|
||||
Este helpers crea QrCodes que conectan un teléfono a una red WiFI.
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID de la red',
|
||||
'password' => 'Password de la red',
|
||||
'hidden' => 'Si la red tiene SSID oculta o no.'
|
||||
]);
|
||||
|
||||
//Conecta a una red abierta.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
]);
|
||||
|
||||
//Conecta a una red abierta y oculta.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
//Conecta a una red segura.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'myPassword'
|
||||
]);
|
||||
|
||||
>WiFi scanning no es compatible con productos Apple.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
##Uso común de QrCode
|
||||
|
||||
Puedes usar un prefijo de la tabla dentro de la sección `generate` para crear un QrCode que almacene informacion avanzada:
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| Usage | Prefix | Example |
|
||||
| --- | --- | --- |
|
||||
| Website URL | http:// | http://www.simplesoftware.io |
|
||||
| Secured URL | https:// | https://www.simplesoftware.io |
|
||||
| E-mail Address | mailto: | mailto:support@simplesoftware.io |
|
||||
| Phone Number | tel: | tel:555-555-5555 |
|
||||
| Text (SMS) | sms: | sms:555-555-5555 |
|
||||
| Text (SMS) With Pretyped Message | sms: | sms::I am a pretyped message |
|
||||
| Text (SMS) With Pretyped Message and Number | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| Geo Address | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
##Uso fuera de Laravel
|
||||
|
||||
Puedes usar este paquete fuera de Laravel instanciando una nueva clase `BaconQrCodeGenerator`.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Crea un QrCode sin Laravel!');
|
||||
340
vendor/simplesoftwareio/simple-qrcode/docs/fr/README.md
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
- [Introduction](#docs-introduction)
|
||||
- [Traductions](#docs-translations)
|
||||
- [Configuration](#docs-configuration)
|
||||
- [Utilisations Simples](#docs-ideas)
|
||||
- [Usage](#docs-usage)
|
||||
- [Helpers](#docs-helpers)
|
||||
- [Usage Courant De QrCode](#docs-common-usage)
|
||||
- [Usage Hors De Laravel](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## Introduction
|
||||
Simple QrCode est un adaptateur facile d'utilisation pour le framework Laravel et qui s'appuie sur le magnifique travail fourni par [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). Nous avons conçu une interface intuitive, facile d'installation et familière aux utilisateurs de Laravel.
|
||||
|
||||
<a id="docs-translations"></a>
|
||||
## Traductions
|
||||
Nous recherchons des utilisateurs parlant arabe, espagnol, français, coréen ou japonnais pour nous aider à traduire cette documentation. Si vous vous en sentez capable, créez une pull request !
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## Configuration
|
||||
|
||||
#### Composer
|
||||
|
||||
Commencez par ajouter le paquet QrCode à la section `require` de votre fichier `composer.json`:
|
||||
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~2"
|
||||
}
|
||||
|
||||
Lancez ensuite la commande `composer update`.
|
||||
|
||||
#### Service Provider
|
||||
|
||||
###### Laravel <= 5.4
|
||||
Ajouter l'entrée `SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class` au tableau `providers` du fichier de configuration `config/app.php`.
|
||||
|
||||
#### Alias
|
||||
|
||||
###### Laravel <= 5.4
|
||||
Enfin, ajoutez l'entrée `'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class` au tableau `aliases` du fichier de configuration `config/app.php`.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## Utilisations Simples
|
||||
|
||||
#### Print View
|
||||
|
||||
L'un des pricipaux usages que nous faisons de ce paquet et d'avoir des QrCodes dans toutes nos vues d'impression. Cela donne la possibilité à nos clients qui le flashent de revenir à la page d'origine du document après que celui-ci a été imprimé. Nous obtenons cette fonctionnalité en ajoutant le code suivant au fichier footer.blade.php.
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Flashez-moi pour revenir à la page d'origine.</p>
|
||||
</div>
|
||||
|
||||
#### Embarquer Un QrCode
|
||||
|
||||
Vous pouvez embarquer un qrcode dans un courriel pour permettre à vos utilisateurs de le flasher. Voici un exemple pour mettre ceci en œuvre dans Laravel :
|
||||
|
||||
// Dans un template blade.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Embarquez-moi dans un courriel!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## Usage
|
||||
|
||||
#### Usage De Base
|
||||
|
||||
L'utilisation du Générateur de QrCode est très simple. La syntaxe minimale est :
|
||||
|
||||
QrCode::generate('Transformez-moi en QrCode !');
|
||||
|
||||
Cela créera un QrCode qui dit "Transformez-moi en QrCode !"
|
||||
|
||||
#### Generate
|
||||
|
||||
`Generate` sert à fabriquer un QrCode.
|
||||
|
||||
QrCode::generate('Transformez-moi en QrCode !');
|
||||
|
||||
>Attention! Cette méthode doit être appelée en dernier si vous l'utilisez dans un appel chaîné.
|
||||
|
||||
Par défaut, `Generate` retournera le contenu d'une image SVG sous forme de chaîne. Vous pouvez afficher cette image directement avec un navigateur moderne dans un template Blade de Laravel de cette façon :
|
||||
|
||||
{!! QrCode::generate('Transformez-moi en QrCode !'); !!}
|
||||
|
||||
La méthode `generate` accepte un second paramètre pour définir un nom de fichier où enregistrer le QrCode.
|
||||
|
||||
QrCode::generate('Transformez-moi en QrCode !', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### Changement De Format
|
||||
|
||||
>Le générateur de QrCode est prévu pour retourner une image SVG par défaut.
|
||||
|
||||
>Attention! La méthode `format` doit être appelée avant toute autre option de formatage, telles que `size`, `color`, `backgroundColor` et `margin`.
|
||||
|
||||
Trois formats sont actuellement supportés : PNG, EPS et SVG. Pour changer de format, utilisez le code suivant :
|
||||
|
||||
QrCode::format('png'); // retourne une image PNG
|
||||
QrCode::format('eps'); // retourne une image EPS
|
||||
QrCode::format('svg'); // retourne une image SVG
|
||||
|
||||
#### Changement De Taille
|
||||
|
||||
>Le générateur de QrCode retournera par défaut le QrCode dans la plus petite taille possible en pixels.
|
||||
|
||||
Vous pouvez changer la taille du QrCode par la méthode `size` qui prend comme paramètre la taille désirée en pixels :
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
#### Changement De Couleur
|
||||
|
||||
>Changez les couleurs de vos QrCode avec précaution car certains lecteurs rencontrent des difficultés avec les QrCodes en couleur.
|
||||
|
||||
Toutes les couleurs doivent être exprimées en RGB (rouge, vert, bleu). Vous pouvez changer la couleur de trait du QrCode par la méthode `color` :
|
||||
|
||||
QrCode::color(255,0,255);
|
||||
|
||||
La couleur de fond peut être définie de la même façon par la méthode `backgroundColor` :
|
||||
|
||||
QrCode::backgroundColor(255,255,0);
|
||||
|
||||
#### Changement Des Marges
|
||||
|
||||
Vous pouvez définir une marge autour du QrCode par la méthode `margin` :
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### Correction D'Erreur
|
||||
|
||||
Il est très aisé de changer le niveau de correction d'erreur. Utilisez la syntaxe suivante :
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
Voici la liste des options supportées pour la méthode `errorCorrection`.
|
||||
|
||||
| Correction d'Erreur | Capacité De Correction |
|
||||
| --- | --- |
|
||||
| L | 7% de redondance. |
|
||||
| M | 15% de redondance. |
|
||||
| Q | 25% de redondance. |
|
||||
| H | 30% de redondance. |
|
||||
|
||||
>L'élévation du niveau de correction d'erreur se fait au détriment de la taille du QrCode et de la quantité de données qu'il peut stocker. Pour en savoir plus, consultez [error correction](http://en.wikipedia.org/wiki/QR_code#Error_correction) (en anglais).
|
||||
|
||||
#### Encodage
|
||||
|
||||
La norme de codage par défaut des caractères contenus dans le QrCode est l'`ISO-8859-1`. Pour en savoir plus sur le codage, voyez [codage des caractères](http://fr.wikipedia.org/wiki/Codage_des_caractères). Vous pouvez changer le codage par le code suivant :
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Transformez-moi en QrCode avec des symboles ♠♥!!');
|
||||
|
||||
| Codage Des Caractères |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
>Une erreur du type `Could not encode content to ISO-8859-1` signifie qu'un mauvais codage est utilisé. Nous recommendons `UTF-8` si vous n'êtes pas sûr.
|
||||
|
||||
#### Merge
|
||||
|
||||
La méthode `merge` fusionne une image sur un QrCode. C'est une pratique courante pour placer un logo dans un QrCode.
|
||||
|
||||
QrCode::merge($nom_de_fichier, $pourcentage, $absolu);
|
||||
|
||||
// Génère un QrCode avec une image centrée.
|
||||
QrCode::format('png')->merge('chemin-vers-l-image.png')->generate();
|
||||
|
||||
// Génère un QrCode avec une image centrée. L'image recouvre jusque 30% du QrCode.
|
||||
QrCode::format('png')->merge('chemin-vers-l-image.png', .3)->generate();
|
||||
|
||||
// Génère un QrCode avec une image centrée. L'image recouvre jusque 30% du QrCode.
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
|
||||
>La méthode `merge` ne supporte que les images PNG.
|
||||
>Le chemin vers l'image est relatif au chemin de base de l'application si $absolu est à `false`. Changez cette variable à `true` pour utiliser des chemins absolus.
|
||||
|
||||
> Vous devriez utiliser un haut niveau de correction d'erreur avec la méthode `merge` pour assurer la bonne lecture du QrCode. Nous recommandons l'utilisation de `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
#### Fusion De Chaîne Binaire
|
||||
|
||||
La méthode `mergeString` est semblable à la méthode `merge` si ce n'est qu'elle prend comme paramètre le contenu du fichier sous forme de chaîne au lieu du nom du fichier. C'est particulièrement utile lorsque vous travaillez avec une façade `Storage`. L'interface de `mergeString` est très similaire à celle de `merge`.
|
||||
|
||||
QrCode::mergeString(Storage::get('chemin/vers/image.png'), $percentage);
|
||||
|
||||
// Génère un QrCode avec une image centrée.
|
||||
QrCode::format('png')->mergeString(Storage::get('chemin/vers/image.png'))->generate();
|
||||
|
||||
// Génère un QrCode avec une image centrée. L'image recouvre jusque 30% du QrCode.
|
||||
QrCode::format('png')->mergeString(Storage::get('chemin/vers/image.png'), .3)->generate();
|
||||
|
||||
>A l'instar de la méthode `merge`, seul le format d'image PNG est supporté. Les même recommandations relatives à la correction d'erreur s'appliquent.
|
||||
|
||||
#### Utilisation Avancée
|
||||
|
||||
Toutes les méthodes supportent le chaînage. La méthode `generate` doit être appelée en dernier et toute modification du `format` en premier. Vous pourriez par exemple écrire :
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Transformez-moi en QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Transformez-moi en QrCode!');
|
||||
|
||||
Vous pouvez afficher une image PNG sans enregistrer de fichier en spécifiant une chaîne brute encodée avec `base64_encode`.
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Transformez-moi en QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## Helpers
|
||||
|
||||
#### Que sont les helpers?
|
||||
|
||||
Les helpers facilitent la création de QrCodes qui déclenchent une action du lecteur lorsqu'ils sont flashés.
|
||||
|
||||
#### E-Mail
|
||||
|
||||
Cet helper génère un QrCode pour l'envoi de courriel dont les destinataire, sujet et contenu peuvent être prédéfinis.
|
||||
|
||||
QrCode::email($destinataire, $sujet, $contenu);
|
||||
|
||||
// Renseigne l'adresse du destinataire
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
// Renseigne le destinataire, le sujet et le contenu du courriel
|
||||
QrCode::email('foo@bar.com', 'Ceci est le sujet.', 'Ceci est le contenu.');
|
||||
|
||||
// Ne renseigne que le sujet et le contenu du courriel
|
||||
QrCode::email(null, 'Ceci est le sujet.', 'Ceci est le contenu.');
|
||||
|
||||
#### Geo
|
||||
|
||||
Cet helper génère un QrCode avec des coordonnées géographiques (latitude et longitude) qui pourront être ouvertes par une application Google Maps ou similaire.
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### Numéro de Téléphone
|
||||
|
||||
Cet helper génère un QrCode qui lorsqu'il est flashé compose un numéro de téléphone.
|
||||
|
||||
QrCode::phoneNumber($numeroDeTelephone);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### SMS (Messages Texte)
|
||||
|
||||
Cet helper génère un QrCode d'envoi de SMS dont le destinataire et le message peuvent être prédéfinis.
|
||||
|
||||
QrCode::SMS($numeroDeTelephone, $message);
|
||||
|
||||
// Crée un SMS pour un numéro de téléphone
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
// Crée un SMS pour un numéro de téléphone avec un message
|
||||
QrCode::SMS('555-555-5555', 'Corps du message');
|
||||
|
||||
#### WiFi
|
||||
|
||||
Cet helper génère un QrCode qui permet la connexion à un réseau WiFi.
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID du réseau',
|
||||
'password' => 'Mot de passe de connexion',
|
||||
'hidden' => 'Indique si le SSID du réseau est masqué ou non.'
|
||||
]);
|
||||
|
||||
// Connexion à un réseau WiFi ouvert
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nom du réseau',
|
||||
]);
|
||||
|
||||
// Connexion à un réseau WiFi ouvert et masqué
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nom du réseau',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
// Connexion à un réseau WiFi sécurisé
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nom du réseau',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'Mot de passe'
|
||||
]);
|
||||
|
||||
>La recherche de réseaux WiFi n'est actuellement pas supportée par les produis Apple.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
## Usage Courant des QrCodes
|
||||
|
||||
Vous pouvez utiliser un des pseudos-protocoles du tableau suivant comme paramètre de la méthode `generate` pour créer un QrCode contenant des informations avancées :
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| Usage | Protocole | Exemple |
|
||||
| --- | --- | --- |
|
||||
| URL de site internet | http:// | http://www.simplesoftware.io |
|
||||
| URL de site internet sécurisé | https:// | https://www.simplesoftware.io |
|
||||
| Adresse de courriel | mailto: | mailto:support@simplesoftware.io |
|
||||
| Numéro de téléphone | tel: | tel:555-555-5555 |
|
||||
| SMS | sms: | sms:555-555-5555 |
|
||||
| SMS avec message pré-défini | sms: | sms::I am a pretyped message |
|
||||
| SMS avec message et numéro de téléphone pré-définis | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| Coordonnées géographiques | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [Voir les exemples](https://fr.wikipedia.org/wiki/Code_QR#Correction_d.27erreur) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
##Usage Hors De Laravel
|
||||
|
||||
Vous pouvez utiliser ce paquet en dehors de Laravel en instanciant un objet de classe `BaconQrCodeGenerator`.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Créer un qrcode sans Laravel!');
|
||||
340
vendor/simplesoftwareio/simple-qrcode/docs/hi/README.md
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
|
||||
- [परिचय](#docs-introduction)
|
||||
- [अनुवाद](#docs-translations)
|
||||
- [विन्यास](#docs-configuration)
|
||||
- [साधारण विचार](#docs-ideas)
|
||||
- [उपयोग](#docs-usage)
|
||||
- [सहायक](#docs-helpers)
|
||||
- [साधारण QrCode उपयोग](#docs-common-usage)
|
||||
- [लरावेल(Laravel) के बाहर उपयोग](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## परिचय
|
||||
सरल क्यूआरकोड [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode) द्वारा प्र्दान किए गये महान कार्य पर आधारित लोकप्रिय Laravel ढ़ाचा के लिए आसानी से प्रयोग करने योग्य आवरण है। हमने लरावेल उपयोगकर्ताओं के लिए परिचित व आसानी से स्थापित करने योग्य एक अंतरफलक बनाया है।
|
||||
|
||||
<a id="docs-translations"></a>
|
||||
## अनुवाद
|
||||
हमे उनकी खोज है जो इस दस्तावेज़ का अरबी, स्पेनिश, फ्रेंच, कोरियाई या जापानी मे अनुवाद करने मे मदद कर सकते हैं। यदि आप एक अनुवाद करने में सक्षम हैं तो कृपया एक पुल अनुरोध बनाए!
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## विन्यास
|
||||
|
||||
#### Composer
|
||||
|
||||
सर्वप्रथं composer.json मे qrcode पॅकेज को अपने require से जोड़ें:
|
||||
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~2"
|
||||
}
|
||||
|
||||
फिर composer update कमॅंड चलाएँ।
|
||||
|
||||
#### Service Provider
|
||||
|
||||
###### Laravel <= 5.4
|
||||
config/app.php में providers array में SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class को रजिस्टर करें।
|
||||
|
||||
#### Aliases (उपनाम)
|
||||
|
||||
###### Laravel <= 5.4
|
||||
आखिर में 'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class को config/app.php विन्यास फ़ाइल में aliases array में रजिस्टर करें।
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## साधारण विचार
|
||||
|
||||
#### Print View (प्रिंट देखें)
|
||||
|
||||
इस पैकेज का मुख्य रूप से उपयोग हम सभी print views मे QrCode डालने के लिए करते हैं। यह हमारे ग्राहकों को स्कैन करके के बाद मूल पृष्ठ पर लौटने के लिए अनुमित करता है। हमने अपने footer.blade.php फ़ाइल में निम्न जोड़कर इसे हासिल किया है।
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Scan me to return to the original page.</p>
|
||||
</div>
|
||||
|
||||
#### Embed A QrCode
|
||||
|
||||
अपने उपयोगकर्ताओं को जल्दी से स्कैन करने के लिए आप एक ई-मेल के अंदर एक qrcode एम्बेड कर सकते हैं। निम्नलिखित लरावेल के साथ ऐसा करने का एक उदाहरण है।
|
||||
|
||||
//Inside of a blade template.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Embed me into an e-mail!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## उपयोग
|
||||
|
||||
#### Basic Usage (साधारण उपयोग)
|
||||
|
||||
QrCode Generator का उपयोग बेहद आसान है:
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
इससे qrcode कहेगा है कि "मुझे एक qrcode में बनाओ!"
|
||||
|
||||
#### Generate
|
||||
|
||||
Generate QrCode बनाने के काम आता है।
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
>सचेत! यह विधि श्रृंखला में अंतिम में पुकारी जानी चाहिए।
|
||||
`जेनरेट` डिफ़ॉल्ट रूप से SVG छवि की स्ट्रिंग लौटता है। आप इसे सीधे ही Laravel's Blade system से निम्न प्रकार से किसी भी आधुनिक ब्राउज़र मे प्रिंट ले सकते हैं:
|
||||
|
||||
{!! QrCode::generate('Make me into a QrCode!'); !!}
|
||||
|
||||
उत्पन्न विधि का एक दूसरे पैरामीटर है जो एक फ़ाइल का नाम और पथ QrCode को बचाने के लिए स्वीकार करता है।
|
||||
|
||||
QrCode::generate('Make me into a QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### Format Change(प्रारूप बदलें)
|
||||
|
||||
>QrCode Generator डिफ़ॉल्ट रूप से SVG चित्र लौटाता है.
|
||||
|
||||
>ध्यान रहे! `format` की विधि को किसी भी अन्य स्वरूपण विकल्प जैसे कि `size`, `color`, `backgroundColor`, व `margin` से पहले ही कॉल करें.
|
||||
|
||||
निम्न तीन स्वरूप वर्तमान मे समर्थित हैं; PNG, EPS, और SVG. निम्न कोड का उपयोग करें:
|
||||
|
||||
QrCode::format('png'); //Will return a PNG image
|
||||
QrCode::format('eps'); //Will return a EPS image
|
||||
QrCode::format('svg'); //Will return a SVG image
|
||||
|
||||
#### Size Change (आकार बदल)
|
||||
|
||||
>QrCode Generator डिफ़ॉल्ट रूप से सबसे छोटी संभव आकार से QrCode बनाएग।
|
||||
|
||||
आप `आकार` विधि का उपयोग कर एक QRCode का आकार बदल सकते हैं। बस निम्न वाक्य-विन्यास का उपयोग करके पिक्सल मे वांछित आकर निर्दिष्ट करें:
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
#### Color Change (रंग का बदलना)
|
||||
|
||||
>QrCode का रंग बदलते समय सतर्क रहें। कई उपयोगकर्ताओं को भिन्न रंगों मे QrCode पढ़ने मे कठिनाई होती है।
|
||||
|
||||
सभी रंगों को RGB(लाल हरा नीला) मे व्यक्त करना आवश्यक है। आप निम्न का उपयोग करने QrCode का रंग बदल सकते हैं:
|
||||
|
||||
QrCode::color(255,0,255);
|
||||
|
||||
पृष्ठभूमि रंग परिवर्तन भी इस ही तरीके से व्यक्त किया जा सकता है।
|
||||
|
||||
QrCode::backgroundColor(255,255,0);
|
||||
|
||||
#### Size Change (हाशिया परिवर्तन)
|
||||
|
||||
एक QrCode के आसपास हाशिया बदलने की क्षमता भी प्रदान की गयी है। इच्छित हाशिया निम्न वाक्य-विन्यास के अनुसार व्यक्त करें:
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### Error Correction (त्रुटि सुधार)
|
||||
|
||||
त्रुटि सुधार के स्तर को बदलना भी आसान है। निम्न वाक्य - विन्यास के अनुसार चलें:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
`errorCorrection` की विधि के लिए निम्न विकल्प समर्थित हैं:
|
||||
|
||||
| गलतीयों का सुधार | प्रस्तावित आश्वासन |
|
||||
| --- | --- |
|
||||
| L | 7% codewords में से बहाल किए जा सकते हैं। |
|
||||
| M | 15% codewords में से बहाल किए जा सकते हैं। |
|
||||
| Q | 25% codewords में से बहाल किए जा सकते हैं। |
|
||||
| H | 30% codewords में से बहाल किए जा सकते हैं। |
|
||||
|
||||
>अधिक त्रुटि सुधार के उपयोग से QrCode बड़ा हो जाता है और कम सूचना जमा कर सकता है। [त्रुटि सुधार](http://en.wikipedia.org/wiki/QR_code#Error_correction) के बारे मे अधिक पढ़ें।
|
||||
|
||||
#### Encoding(एन्कोडिंग)
|
||||
|
||||
वर्ण एन्कोडिंग को बदलें जिसका प्रयोग QrCode का निर्माण करने के लिए किया जाता है। डिफ़ॉल्ट रूप से `ISO-8859-1` एनकोडर के रूप में चयनित है।[वर्ण एनकोडिंग](http://en.wikipedia.org/wiki/Character_encoding) के बारे में अधिक पढ़ें। आप निम्न में से किसी के लिए इसे बदल सकते हैं:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Make me a QrCode with special symbols ♠♥!!');
|
||||
|
||||
| वर्ण एनकोडर |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
>`Could not encode content to ISO-8859-1` त्रुटि का अर्थ है कि ग़लत वर्ण एनकोड का प्रकार उपयोग किया गया है। यदि आप अनिश्चित हैं तो हमारा सुझाव है कि `UTF-8` का उपयोग करें।
|
||||
|
||||
#### Merge(विलय)
|
||||
|
||||
`मर्ज` विधि एक QrCode पर एक छवि विलीन करता है। यह आमतौर पर एक QrCode के भीतर लोगो रखने के लिए प्रयोग किया जाता है।
|
||||
|
||||
QrCode::merge($filename, $percentage, $absolute);
|
||||
|
||||
//Generates a QrCode with an image centered in the middle.
|
||||
QrCode::format('png')->merge('path-to-image.png')->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
|
||||
>`मर्`ज विधि में अभी केवल PNG ही समर्थित है।
|
||||
>filepath app, base path से सापेक्षित है यदि `$absolute` सेट है `false` पर। इसे `true` से बदलें absolute paths पाने के लिए।
|
||||
|
||||
>आपको `merge` विधि का इस्तेमाल करते समय उच्च स्तर के त्रुटि सुधार का उपयोग करना चाहिए। सुझाव है कि `errorCorrection('H')` का उपयोग करें।
|
||||
|
||||

|
||||
|
||||
#### Merge Binary String(द्विआधारी स्ट्रिंग का विलय)
|
||||
|
||||
`mergeString` विधि `मर्ज कॉल` वाले ही परिणाम पाने के लिए प्रयोग किया जा सकता है, सिवाय इसके कि इसमे आपको फ़ाइल पथ की बजाय फाइल की एक प्रतिनिधित्व स्ट्रिंग प्रदान करनी होती है। यह तब उपयोगी है जब `स्टोरेज` मुखौटे के साथ काम किया जाता है। इसका इंटरफेस मर्ज कॉल की तरह ही है।
|
||||
|
||||
QrCode::mergeString(Storage::get('path/to/image.png'), $percentage);
|
||||
|
||||
//Generates a QrCode with an image centered in the middle.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
|
||||
|
||||
>As with the normal `merge` call, only PNG is supported at this time. The same applies for error correction, high levels are recommened.
|
||||
|
||||
#### Advance Usage(अग्रिम उपयोग)
|
||||
|
||||
सभी तरीके श्रृंखलन का समर्थन करते हैं। `generate` तरीका अंत मे कॉल करना तथा तरीका कोई `format` का बदलाव सबसे पहले कॉल करना आवश्यक है। जैसे की आप निम्न मे से कोई भी रन कर सकते हैं:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Make me a QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Make me a QrCode!');
|
||||
|
||||
आप बिना फ़ाइल सुरक्षित करे, कच्चे स्ट्रिंग व `base64_encode` की एन्कोडेंग देकर भी PNG प्रदर्शित कर सकते हैं।
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Make me into an QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## सहायक
|
||||
|
||||
#### सहायक क्या है ?
|
||||
|
||||
सहायक QrCode का निर्माण करने का साधारण तरीका है जो स्कैन करने पर पाठक से निश्चित कार्रवाई करवाते हैं।
|
||||
|
||||
#### E-Mail (ई-मेल)
|
||||
|
||||
यह सहायक ई-मेल qrcode का निर्माण करता है जो ई-मेल का पता, विषय तथा शरीर भरने मे सक्षम होता है।
|
||||
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
//Fills in the to address
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
//Fills in the to address, subject, and body of an e-mail.
|
||||
QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');
|
||||
|
||||
//Fills in just the subject and body of an e-mail.
|
||||
QrCode::email(null, 'This is the subject.', 'This is the message body.');
|
||||
|
||||
#### Geo (जियो)
|
||||
|
||||
यह सहायक अक्षांश व देशान्तर का निर्माण करता है जिसे फोन पढ़ व Google Maps (गूगल मांचित्र) या अन्य app मे खोल सकता है।
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### Phone Number (फ़ोन नंबर)
|
||||
|
||||
इस सहायक द्वारा उत्तपन्न qrCode स्कैन करने पर नंबर डायल किया जा सकता है।
|
||||
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### SMS (पाठ संदेश)
|
||||
|
||||
इस सहायक द्वारा उत्तपन्न QrCode स्कैन करने पर SMS संदेश का भेजने का पता तथा संदेश का शरीर पहले से भरा जा सकता है।
|
||||
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
//Creates a text message with the number filled in.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
//Creates a text message with the number and message filled in.
|
||||
QrCode::SMS('555-555-5555', 'Body of the message');
|
||||
|
||||
#### Wi-Fi (वाई-फाई)
|
||||
|
||||
इस सहायक द्वारा उत्तपन्न qrCode स्कैन करने पर वाईफाई नेटवर्क से जुड़ा जा सकता है।
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID of the network',
|
||||
'password' => 'Password of the network',
|
||||
'hidden' => 'Whether the network is a hidden SSID or not.'
|
||||
]);
|
||||
|
||||
//Connects to an open WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
]);
|
||||
|
||||
//Connects to an open, hidden WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
//Connects to an secured, WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'myPassword'
|
||||
]);
|
||||
|
||||
>वाई-फाई स्कैनिंग Apple उत्पादों में अभी समर्थित नही है।
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
## साधारण QrCode उपयोग
|
||||
|
||||
आप निम्न तालिका मे से `generate` अनुभाग मे पाए गये उपसर्ग का उपयोग करके और अधिक उन्नत जानकारी स्टोर करने के लिए QrCode का निर्माण कर सकते हैं:
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| प्रयोग | उपसर्ग | उदाहरण |
|
||||
| --- | --- | --- |
|
||||
| Website URL | http:// | http://www.simplesoftware.io |
|
||||
| Secured URL | https:// | https://www.simplesoftware.io |
|
||||
| E-mail Address | mailto: | mailto:support@simplesoftware.io |
|
||||
| Phone Number | tel: | tel:555-555-5555 |
|
||||
| Text (SMS) | sms: | sms:555-555-5555 |
|
||||
| Text (SMS) With Pretyped Message | sms: | sms::I am a pretyped message |
|
||||
| Text (SMS) With Pretyped Message and Number | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| Geo Address | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
## लरावेल(Laravel) के बाहर उपयोग
|
||||
|
||||
आप `BaconQrCodeGenerator` नमक नयी कक्षा स्थापित करके इस पैकेज का लरावेल के बाहर भी उपयोग कर सकते हैं।
|
||||
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Make a qrcode without Laravel!');
|
||||
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/200-pixels.png
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/250-pixels.png
vendored
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/circle-eye.png
vendored
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/diagonal.png
vendored
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/dot.png
vendored
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/example-1.png
vendored
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/example-2.png
vendored
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/eye-0.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/eye-1.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/eye-2.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/horizontal.png
vendored
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/inverse_diagonal.png
vendored
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/make-me-into-a-qrcode.png
vendored
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/merged-qrcode.png
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/radial.png
vendored
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/red-25-transparent-background.png
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/red-25-transparent.png
vendored
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/red-background.png
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/red-qrcode.png
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/round.png
vendored
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/docs/imgs/vertical.png
vendored
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
342
vendor/simplesoftwareio/simple-qrcode/docs/it/README.md
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
|
||||
- [Introduzione](#docs-introduction)
|
||||
- [Traduzioni](#docs-translations)
|
||||
- [Configurazione](#docs-configuration)
|
||||
- [Semplici Utilizzi](#docs-ideas)
|
||||
- [Utilizzo](#docs-usage)
|
||||
- [Helpers](#docs-helpers)
|
||||
- [Uso generico dei QrCode](#docs-common-usage)
|
||||
- [Uso al di fuori di Laravel](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## Introduzione
|
||||
Simple QrCode è un semplice wrapper per il popolare framework Laravel basato sul bellissimo lavoro [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). Abbiamo creato un'interfaccia familiare e semplice da installare per gli utenti Laravel.
|
||||
|
||||
<a id="docs-translations"></a>
|
||||
## Traduzioni
|
||||
Siamo alla ricerca di utenti che ci aiutino a tradurre la documentazione in Arabo, Spagnolo, Francese, Coreano o Giapponese. Se pensate di potercela fare non esitate a fare una pull request!
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## Configurazione
|
||||
|
||||
#### Composer
|
||||
|
||||
Per prima cosa, aggiungete il pacchetto di Simple QrCode al file `require` in `composer.json`:
|
||||
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~2"
|
||||
}
|
||||
|
||||
Ora lanciate il comando `composer update`.
|
||||
|
||||
#### Service Provider
|
||||
|
||||
###### Laravel <= 5.4
|
||||
Registrate `SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class` nel vostro `config/app.php` all'interno dell'array `providers`.
|
||||
|
||||
#### Alias
|
||||
|
||||
###### Laravel <= 5.4
|
||||
Infine, registrate `'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class` nel vostro file di configurazione `config/app.php` all'interno dell'array `aliases`.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## Semplici Utilizzi
|
||||
|
||||
#### Print View
|
||||
|
||||
Uno degli usi principali di questo pacchetto è la possibilità di avere codici Qr in tutte le nostre print views. Questo permette all'utente di tornare alla pagina originale semplicemente facendo lo scan del codice. Tutto ciò è possibile aggiungendo le seguenti linee nel nostro footer.blade.php.
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Scansionami per tornare alla pagina principale.</p>
|
||||
</div>
|
||||
|
||||
#### Incorporare un QrCode
|
||||
|
||||
Potreste incorporare un codice Qr in una e-mail per permettere agli utenti uno scan immediato. Il seguente è un esempio di come potresti fare tutto ciò con Laravel.
|
||||
|
||||
//Inside of a blade template.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Incorporami in una e-mail!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## Utilizzo
|
||||
|
||||
#### Utilizzo Base
|
||||
|
||||
Usare il generatori di codici Qr è molto semplice. La sintassi più semplice è:
|
||||
|
||||
QrCode::generate('Trasformami in un QrCode!');
|
||||
|
||||
Questo comando produrrà un codice Qr che dice "Trasformami in un QrCode!"
|
||||
|
||||
#### Generate
|
||||
|
||||
`Generate` è usato per creare codici Qr:
|
||||
|
||||
QrCode::generate('Trasformami in un QrCode!');
|
||||
|
||||
>Attenzione! Questo metodo deve essere chiamato per ultimo se lo si usa all'interno di una catena (chain).
|
||||
|
||||
`Generate` restituirà, di default, una stringa di immagini SVG. Puoi stamparla direttamente in un browser recente dal sistema Blade di Laravel con il seguente codice:
|
||||
|
||||
{!! QrCode::generate('Make me into a QrCode!'); !!}
|
||||
|
||||
Il metodo `generate` accetta un secondo parametro che indica la directory nella quale verrà salvato il codice Qr.
|
||||
|
||||
QrCode::generate('Make me into a QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### Variazione del formato
|
||||
|
||||
>QrCode Generator è impostato di default per generare immagini SVG.
|
||||
|
||||
>Attenzione! Il metodo `format` deve essere chiamato prima di qualunque altra opzione di formato come `size`, `color`, `backgroundColor`, o `margin`.
|
||||
|
||||
Momentaneamente, sono supportati tre formati: PNG, EPS e SVG. Per cambiare il formato usare uno dei seguenti comandi:
|
||||
|
||||
QrCode::format('png'); //Genererà un'immagine PNG
|
||||
QrCode::format('eps'); //Genererà un'immagine EPS
|
||||
QrCode::format('svg'); //Genererà un'immagine SVG
|
||||
|
||||
#### Variazione della grandezza
|
||||
|
||||
>QrCode Generator restituirà, di default, la più piccola grandezza possibile per creare il QrCode.
|
||||
|
||||
Puoi cambiare la grandezza del codice Qr usando il metodo `size`. Basta specificare la grandezza desiderata, in pixel, usando la seguente sintassi:
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
#### Variazione del colore
|
||||
|
||||
>Fai attenzione quando cambi il colore di un QrCode! Alcuni lettori potrebbero avere dei problemi a leggere dei codici Qr colorati diversamente.
|
||||
|
||||
Tutti i colori dovranno essere espressi in RGB (Rosso Verde Blu). Puoi cambiare il colore di un QrCode usando questa sintassi:
|
||||
|
||||
QrCode::color(255,0,255);
|
||||
|
||||
Puoi anche cambiare il colore di sfondo con la seguente istruzione:
|
||||
|
||||
QrCode::backgroundColor(255,255,0);
|
||||
|
||||
#### Variazione del margine
|
||||
|
||||
E' anche possibile variare il margine attorno al codice Qr. Basta infatti specificare la grandezza del margine nella seguente sintassi:
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### Correzione dell'errore
|
||||
|
||||
Cambiare il livello di correzione dell'errore è facile. Per farlo, usare questa sintassi:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
Seguono le opzioni supportate dal metodo `errorCorrection`.
|
||||
|
||||
| Error Correction | Assurance Provided |
|
||||
| --- | --- |
|
||||
| L | 7% of codewords can be restored. |
|
||||
| M | 15% of codewords can be restored. |
|
||||
| Q | 25% of codewords can be restored. |
|
||||
| H | 30% of codewords can be restored. |
|
||||
|
||||
>Più error correction viene usata, più sarà grande il QrCode e meno dati sarà in grando di contenere. Leggi di più a riguardo [error correction](http://en.wikipedia.org/wiki/QR_code#Error_correction).
|
||||
|
||||
#### Encoding
|
||||
|
||||
Puoi cambiare l'encoding dei caratteri utilizzato per creare il codice Qr. Di default è selezionato `ISO-8859-1`. Leggi di più a riguardo [character encoding](http://en.wikipedia.org/wiki/Character_encoding)
|
||||
Puoi cambiare l'encoding utilizzando:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Trasformami in un QrCode con simboli speciali ??!!');
|
||||
|
||||
| Encoder dei caratteri |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
>L'errore `Could not encode content to ISO-8859-1` significa che si sta usando l'encoding erraro. E' raccomandato usare `UTF-8` se non si è sicuri.
|
||||
|
||||
#### Merge
|
||||
|
||||
Il metodo `merge` unisce un immagine con un QrCode. Il merge è molto usato per inserire loghi in un codice Qr.
|
||||
|
||||
QrCode::merge($filename, $percentage, $absolute);
|
||||
|
||||
//Genera un QrCode con una immagine al centro.
|
||||
QrCode::format('png')->merge('path-to-image.png')->generate();
|
||||
|
||||
//Genera un QrCode con una immagine al centro. L'immagine inserita occupa il 30% del codice Qr.
|
||||
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
|
||||
|
||||
//Genera un QrCode con una immagine al centro. L'immagine inserita occupa il 30% del codice Qr.
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
|
||||
>Il metodo `merge` supporta solamente il formato PNG.
|
||||
>Il percorso specificato è relativo alla base path se `$absolute` è impostata su `false`. Cambiare questa variabile in `true` per utilizzare percorsi assoluti.
|
||||
|
||||
>Dovresti usare un alto livello di error correction quando usi il metodo `merge` per assicurarti che il Qr sia ancora leggibile. Raccomandiamo di usare `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
#### Merge Binary String
|
||||
|
||||
Il metodo `mergeString` può essere usato per ottenere quasi lo stesso risultato di `merge`, con la differenza che permette di inserire una rappresentazione testuale del file al posto del percorso. Questo è utile quando si lavora con la facade `Storage`. La sua interfaccia è molto simile a quella di `merge`.
|
||||
|
||||
QrCode::mergeString(Storage::get('path/to/image.png'), $percentage);
|
||||
|
||||
//Genera un QrCode con una immagine al centro.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
|
||||
|
||||
//Genera un QrCode con una immagine al centro. L'immagine inserita occupa il 30% del codice Qr.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
|
||||
|
||||
>Come la chiamata a `merge`, anche questa volta è supportato solamente il formato PNG. Lo stesso vale per gli error correction, H è il valore raccomandato.
|
||||
|
||||
#### Utilizzo Avanzato
|
||||
|
||||
Tutti i metodi supportano il chaining. Il metodo `generate` deve essere chiamato per ultimo e tutti gli eventuali metodi `format` devono essere chiamati per primi. Per esempio sono validi i seguenti:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Make me a QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Trasformami in un QrCode!');
|
||||
|
||||
Puoi mostrare un'immagine PNG senza salvare il file relativo impostando una stringa e scegliendo l'encoding `base64_encode`.
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Trasformami in un QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## Helpers
|
||||
|
||||
#### Cosa sono gli helpers?
|
||||
|
||||
Gli Helpers sono un metodo molto semplice per creare codici Qr che permettono al lettore di eseguire una certa azione quando scansionati.
|
||||
|
||||
#### E-Mail
|
||||
|
||||
Questo helper genera un QrCode in grado di riempire i campi di una e-mail quali indirizzo, oggetto e corpo.
|
||||
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
//Fills in the to address
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
//Fills in the to address, subject, and body of an e-mail.
|
||||
QrCode::email('foo@bar.com', 'Questo è l'oggetto.', 'Questo è il corpo del messaggio.');
|
||||
|
||||
//Fills in just the subject and body of an e-mail.
|
||||
QrCode::email(null, 'Questo è l'oggetto.', 'Questo è il corpo del messaggio.');
|
||||
|
||||
#### Geo
|
||||
|
||||
Questo helper genera una latitudine e una longitudine che un telefono può leggere ed aprire con Google Maps o applicazioni simili.
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### Numeri di Telefono
|
||||
|
||||
Questo helper genera un QrCode che, una volta scansionato, digita un numero di telefono.
|
||||
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### SMS (Messaggi)
|
||||
|
||||
Questo helper crea messaggi SMS che possono essere precompilati con il destinatario e il corpo del messaggio.
|
||||
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
//Creates a text message with the number filled in.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
//Creates a text message with the number and message filled in.
|
||||
QrCode::SMS('555-555-5555', 'Corpo del messaggio.');
|
||||
|
||||
#### WiFi
|
||||
|
||||
Questo helper crea codici Qr scansionabili che permettono la connessione del telefono ad una determinata rete WiFi.
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID della rete',
|
||||
'password' => 'Password della rete',
|
||||
'hidden' => 'Whether the network is a hidden SSID or not.'
|
||||
]);
|
||||
|
||||
//Connects to an open WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nome Rete',
|
||||
]);
|
||||
|
||||
//Connects to an open, hidden WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nome Rete',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
//Connects to an secured, WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nome Rete',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'miaPassword'
|
||||
]);
|
||||
|
||||
>La scansione WiFi non è al momento supportata sui dispositivi Apple.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
##Uso generico dei QrCode
|
||||
|
||||
Puoi utilizzare un prefisso della tabella sottostante per generare dei codici Qr in grado di contenere maggiori informazioni:
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| Usage | Prefix | Example |
|
||||
| --- | --- | --- |
|
||||
| Website URL | http:// | http://www.simplesoftware.io |
|
||||
| Secured URL | https:// | https://www.simplesoftware.io |
|
||||
| E-mail Address | mailto: | mailto:support@simplesoftware.io |
|
||||
| Phone Number | tel: | tel:555-555-5555 |
|
||||
| Text (SMS) | sms: | sms:555-555-5555 |
|
||||
| Text (SMS) With Pretyped Message | sms: | sms::I am a pretyped message |
|
||||
| Text (SMS) With Pretyped Message and Number | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| Geo Address | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
##Uso al di fuori di Laravel
|
||||
|
||||
Puoi usare questo package al di fuori di Laravel istanziando una nuova classe `BaconQrCodeGenerator`.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Crea un QrCode senza Laravel!');
|
||||
363
vendor/simplesoftwareio/simple-qrcode/docs/ja/README.md
vendored
Normal file
@@ -0,0 +1,363 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
|
||||
#### [Español](https://www.simplesoftware.io/simple-qrcode/es) | [Français](https://www.simplesoftware.io/simple-qrcode/fr) | [Italiano](https://www.simplesoftware.io/simple-qrcode/it) | [Português](https://www.simplesoftware.io/simple-qrcode/pt-br) | [Русский](https://www.simplesoftware.io/simple-qrcode/ru) | [हिंदी](https://www.simplesoftware.io/simple-qrcode/hi) | [汉语](https://www.simplesoftware.io/simple-qrcode/zh)
|
||||
|
||||
- [Introduction](#docs-introduction)
|
||||
- [Translations](#docs-translations)
|
||||
- [Configuration](#docs-configuration)
|
||||
- [Simple Ideas](#docs-ideas)
|
||||
- [Usage](#docs-usage)
|
||||
- [Helpers](#docs-helpers)
|
||||
- [Common QrCode Usage](#docs-common-usage)
|
||||
- [Usage Outside of Laravel](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## イントロダクション
|
||||
Simple QrCode は [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode)を元に作られた 人気のあるLaravelフレームワークで簡単に使う事のできるラッパーです。
|
||||
|
||||
|
||||
Simple QrCode is an easy to use wrapper for the popular Laravel framework based on the great work provided by [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). We created an interface that is familiar and easy to install for Laravel users.
|
||||
|
||||
<a id="docs-translations"></a>
|
||||
## 翻訳
|
||||
この文書の翻訳を手伝ってくれるアラビア語、スペイン語、フランス語、韓国語、日本語を話すユーザーを探しています。 翻訳が可能な場合はプルリクエストを作成してください。
|
||||
|
||||
We are looking for users who speak Arabic, Spanish, French, Korean or Japanese to help translate this document. Please create a pull request if you are able to make a translation!
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## 設定
|
||||
|
||||
#### Composer
|
||||
最初にあなたの `composer.json` に Simple QrCode パッケージを追加する必要があります。
|
||||
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~2"
|
||||
}
|
||||
追加したら `composer update` コマンドを実行します。
|
||||
|
||||
#### サービスプロバイダー
|
||||
|
||||
###### Laravel <= 5.4
|
||||
(あなたが Simple QrCode を入れる laravelの) `config/app.php` の `providers`配列 に `SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class` を登録します。
|
||||
|
||||
#### Aliases
|
||||
|
||||
###### Laravel <= 5.4
|
||||
最後に `config/app.php` の `aliases`配列に `'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class` を登録します。
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## かんたんに使う
|
||||
|
||||
#### 画面に表示する
|
||||
|
||||
このパッケージの主なアイテムは 画面に表示する機能です。
|
||||
カスタマーはコードをスキャンするだけで 画面に戻ることが出来ます。以下の内容をfooter.blade.php に追加しました。
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Scan me to return to the original page.</p>
|
||||
</div>
|
||||
|
||||
#### QrCodeを埋め込む
|
||||
|
||||
ユーザーがすばやくスキャンできるように、電子メールの中にqrcodeを埋め込むことができます。 以下はLaravelでこれを行う方法の例です。
|
||||
|
||||
//Inside of a blade template.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Embed me into an e-mail!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## Usage
|
||||
|
||||
#### 基本的な使い方
|
||||
|
||||
QrCode Generatorを使うのはとても簡単です。 最も基本的な構文は次のとおりです。
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
これで「Make me into a QrCode!」というQrCodeが作成されます。
|
||||
|
||||
#### 生成する
|
||||
|
||||
`Generate`はQrCodeを作るのに使われます。
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
>要注意: チェーン内で使用する場合は、このメソッドを最後に呼び出す必要があります。
|
||||
|
||||
`Generate`はデフォルトで SVG イメージ文字列を返します。
|
||||
Laravel Bladeに以下の様に書くことで モダンなブラウザに表示することができます。
|
||||
|
||||
{!! QrCode::generate('Make me into a QrCode!'); !!}
|
||||
|
||||
`generate`メソッドの第二引数はQrCodeを保存するパスとファイルネームです。
|
||||
|
||||
QrCode::generate('Make me into a QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### フォーマットを変える
|
||||
|
||||
>QrCode Generator のデフォルトフォーマットはSVGイメージです。
|
||||
|
||||
>要注意: `format`メソッドは` size`、 `color`、` backgroundColor`、 `margin`のような他のフォーマットオプションの前に呼ばれなければなりません。
|
||||
|
||||
現在PNG、EPS、およびSVGの 3つのフォーマットがサポートされています。
|
||||
フォーマットを変更するには、次のコードを使用します。
|
||||
|
||||
QrCode::format('png'); //Will return a PNG image
|
||||
QrCode::format('eps'); //Will return a EPS image
|
||||
QrCode::format('svg'); //Will return a SVG image
|
||||
|
||||
#### サイズの変更
|
||||
|
||||
>QrCode GeneratorはデフォルトでQrCodeを作成するためにピクセルで可能な最小サイズを返します。
|
||||
|
||||
`size`メソッドを使うことでQrCodeのサイズを変えることができます。 次の構文を使用して、必要なサイズをピクセル単位で指定します。
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
#### 色の変更
|
||||
|
||||
>要注意 色を変えるときには注意してください。QrCodeの読み込みが難しくなる 色が有ります。
|
||||
|
||||
すべての色はRGB (Red Green Blue)で表現する必要があります。 次のようにしてQrCodeの色を変更できます:
|
||||
|
||||
QrCode::color(255,0,255);
|
||||
|
||||
背景色の変更もサポートされており、同じ方法で表現できます。
|
||||
|
||||
QrCode::backgroundColor(255,255,0);
|
||||
|
||||
#### マージンの変更
|
||||
|
||||
QrCode周辺のマージンを変更する機能もサポートされています。 次の構文を使用してマージンを指定します:
|
||||
QrCode::margin(100);
|
||||
|
||||
#### Error Correction
|
||||
|
||||
Changing the level of error correction is easy. Just use the following syntax:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
The following are supported options for the `errorCorrection` method.
|
||||
|
||||
| Error Correction | Assurance Provided |
|
||||
| --- | --- |
|
||||
| L | 7% of codewords can be restored. |
|
||||
| M | 15% of codewords can be restored. |
|
||||
| Q | 25% of codewords can be restored. |
|
||||
| H | 30% of codewords can be restored. |
|
||||
|
||||
>The more error correction used; the bigger the QrCode becomes and the less data it can store. Read more about [error correction](http://en.wikipedia.org/wiki/QR_code#Error_correction).
|
||||
|
||||
#### Encoding
|
||||
|
||||
Change the character encoding that is used to build a QrCode. By default `ISO-8859-1` is selected as the encoder. Read more about [character encoding](http://en.wikipedia.org/wiki/Character_encoding) You can change this to any of the following:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Make me a QrCode with special symbols ♠♥!!');
|
||||
|
||||
| Character Encoder |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
>An error of `Could not encode content to ISO-8859-1` means that the wrong character encoding type is being used. We recommend `UTF-8` if you are unsure.
|
||||
|
||||
#### Merge
|
||||
|
||||
The `merge` method merges an image over a QrCode. This is commonly used to placed logos within a QrCode.
|
||||
|
||||
QrCode::merge($filename, $percentage, $absolute);
|
||||
|
||||
//Generates a QrCode with an image centered in the middle.
|
||||
QrCode::format('png')->merge('path-to-image.png')->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
|
||||
>The `merge` method only supports PNG at this time.
|
||||
>The filepath is relative to app base path if `$absolute` is set to `false`. Change this variable to `true` to use absolute paths.
|
||||
|
||||
>You should use a high level of error correction when using the `merge` method to ensure that the QrCode is still readable. We recommend using `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
#### Merge Binary String
|
||||
|
||||
The `mergeString` method can be used to achieve the same as the `merge` call, except it allows you to provide a string representation of the file instead of the filepath. This is usefull when working with the `Storage` facade. It's interface is quite similar to the `merge` call.
|
||||
|
||||
QrCode::mergeString(Storage::get('path/to/image.png'), $percentage);
|
||||
|
||||
//Generates a QrCode with an image centered in the middle.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
|
||||
|
||||
>As with the normal `merge` call, only PNG is supported at this time. The same applies for error correction, high levels are recommened.
|
||||
|
||||
#### Advance Usage
|
||||
|
||||
All methods support chaining. The `generate` method must be called last and any `format` change must be called first. For example you could run any of the following:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Make me a QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Make me a QrCode!');
|
||||
|
||||
You can display a PNG image without saving the file by providing a raw string and encoding with `base64_encode`.
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Make me into an QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## Helpers
|
||||
|
||||
#### What are helpers?
|
||||
|
||||
Helpers are an easy way to create QrCodes that cause a reader to perform a certain action when scanned.
|
||||
|
||||
#### BitCoin
|
||||
|
||||
This helpers generates a scannable bitcoin to send payments. [More information](https://bitco.in/en/developer-guide#plain-text)
|
||||
|
||||
QrCode::BTC($address, $amount);
|
||||
|
||||
//Sends a 0.334BTC payment to the address
|
||||
QrCode::BTC('bitcoin address', 0.334);
|
||||
|
||||
//Sends a 0.334BTC payment to the address with some optional arguments
|
||||
QrCode::size(500)->BTC('address', 0.0034, [
|
||||
'label' => 'my label',
|
||||
'message' => 'my message',
|
||||
'returnAddress' => 'https://www.returnaddress.com'
|
||||
]);
|
||||
|
||||
#### E-Mail
|
||||
|
||||
This helper generates an e-mail qrcode that is able to fill in the e-mail address, subject, and body.
|
||||
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
//Fills in the to address
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
//Fills in the to address, subject, and body of an e-mail.
|
||||
QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');
|
||||
|
||||
//Fills in just the subject and body of an e-mail.
|
||||
QrCode::email(null, 'This is the subject.', 'This is the message body.');
|
||||
|
||||
#### Geo
|
||||
|
||||
This helper generates a latitude and longitude that a phone can read and open the location up in Google Maps or similar app.
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### Phone Number
|
||||
|
||||
This helper generates a QrCode that can be scanned and then dials a number.
|
||||
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### SMS (Text Messages)
|
||||
|
||||
This helper makes SMS messages that can be prefilled with the send to address and body of the message.
|
||||
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
//Creates a text message with the number filled in.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
//Creates a text message with the number and message filled in.
|
||||
QrCode::SMS('555-555-5555', 'Body of the message');
|
||||
|
||||
#### WiFi
|
||||
|
||||
This helpers makes scannable QrCodes that can connect a phone to a WiFI network.
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID of the network',
|
||||
'password' => 'Password of the network',
|
||||
'hidden' => 'Whether the network is a hidden SSID or not.'
|
||||
]);
|
||||
|
||||
//Connects to an open WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
]);
|
||||
|
||||
//Connects to an open, hidden WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
//Connects to an secured, WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'myPassword'
|
||||
]);
|
||||
|
||||
>WiFi scanning is not currently supported on Apple Products.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
## Common QrCode Usage
|
||||
|
||||
You can use a prefix found in the table below inside the `generate` section to create a QrCode to store more advanced information:
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| Usage | Prefix | Example |
|
||||
| --- | --- | --- |
|
||||
| Website URL | http:// | http://www.simplesoftware.io |
|
||||
| Secured URL | https:// | https://www.simplesoftware.io |
|
||||
| E-mail Address | mailto: | mailto:support@simplesoftware.io |
|
||||
| Phone Number | tel: | tel:555-555-5555 |
|
||||
| Text (SMS) | sms: | sms:555-555-5555 |
|
||||
| Text (SMS) With Pretyped Message | sms: | sms::I am a pretyped message |
|
||||
| Text (SMS) With Pretyped Message and Number | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| Geo Address | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
## Usage Outside of Laravel
|
||||
|
||||
You may use this package outside of Laravel by instantiating a new `BaconQrCodeGenerator` class.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Make a qrcode without Laravel!');
|
||||
358
vendor/simplesoftwareio/simple-qrcode/docs/kr/README.md
vendored
Normal file
@@ -0,0 +1,358 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
- [소개(Introduction)](#docs-introduction)
|
||||
- [번역(Translations)](#docs-translations)
|
||||
- [설정(Configuration)](#docs-configuration)
|
||||
- [간단한 아이디어(Simple Ideas)](#docs-ideas)
|
||||
- [사용법(Usage)](#docs-usage)
|
||||
- [헬퍼(Helpers)](#docs-helpers)
|
||||
- [사용 예시(Common QrCode Usage)](#docs-common-usage)
|
||||
- [라라벨을 사용하지 않는 곳에서 사용하기(Usage Outside of Laravel)](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## 소개(Introduction)
|
||||
Simple QrCode는 인기가 많은 라라벨 프레임워크 상에서 쉽게 사용할 수 있는 Qr코드 생성 패키지로, 정말 잘 만들어진 [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode)를 기반으로 만들어졌습니다. 우리는 라라벨을 이용하는 사람들에게 친숙하고 쉬운 인터페이스를 만들었습니다.
|
||||
|
||||
<a id="docs-translations"></a>
|
||||
## 번역(Translations)
|
||||
우리는 현재 이 문서의 번역을 도와줄 아랍어, 스페인어, 불어, 혹은 일본어를 할 줄 아는 사람을 찾고 있습니다. 만약 번역을 해주실 수 있다면, 풀리퀘스트(Pull request)를 보내주세요!
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## 설정(Configuration)
|
||||
|
||||
#### Composer
|
||||
|
||||
우선, Simple QrCode 패키지를 `composer.json` 파일의 `require`에 추가해주세요:
|
||||
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~2"
|
||||
}
|
||||
|
||||
그 다음으로, `composer update` 명령을 실행해주세요.
|
||||
|
||||
#### Service Provider
|
||||
|
||||
###### Laravel <= 5.4
|
||||
`config/app.php`의 `providers` 배열 안에, `SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class`를 등록해주세요.
|
||||
|
||||
#### Aliases
|
||||
|
||||
###### Laravel <= 5.4
|
||||
마지막으로, `config/app.php` 설정 파일의 `aliases` 배열 안에, `'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class`를 등록해주세요.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## 간단한 아이디어(Simple Ideas)
|
||||
|
||||
#### 화면에 출력하기
|
||||
|
||||
이 패키지를 사용하는 핵심적인 이유 중 하나는 Qr코드를 화면에 출력하기 위함입니다. 이 패키지는 우리의 고객들이 Qr코드를 스캔하는 것만으로 원래의 페이지로 돌아가게 할 수 있습니다. 우리는 이를 footer.blade.php 파일에 아래의 코드를 추가함으로서 해냈습니다.
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Scan me to return to the original page.</p>
|
||||
</div>
|
||||
|
||||
#### Qr코드 Embed하기
|
||||
|
||||
Qr코드를 이메일에 embed함으로서 유저가 쉽고 빠르게 스캔할 수 있게 할 수도 있습니다. 아래의 코드는 라라벨에서의 예시입니다.
|
||||
|
||||
//Inside of a blade template.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Embed me into an e-mail!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## 사용법(Usage)
|
||||
|
||||
#### 간단한(Basic) 사용법
|
||||
|
||||
Qr코드를 생성하는 방법은 정말 쉽습니다. 가장 간단한 구문은:
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
위 코드는 "Make me into a QrCode!"라는 문장을 Qr코드로 만들어줍니다.
|
||||
|
||||
#### 생성(Generate)
|
||||
|
||||
`Generate`는 Qr코드를 만들기 위해 사용됩니다.
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
>주의하세요! 만약 메소드 체이닝을 사용하신다면, 이 메소드는 마지막에 호출되어야 합니다.
|
||||
|
||||
기본적인 `Generate`는 SVG 이미지 문자열을 반환합니다. 라라벨의 Blade를 사용하시면, 현대의 브라우저에는 직접적으로 출력하실 수 있습니다. 아래의 코드를 참고하세요:
|
||||
|
||||
{!! QrCode::generate('Make me into a QrCode!'); !!}
|
||||
|
||||
`generate` 메소드의 두 번째 인자는 Qr코드를 저장할 파일명과 경로입니다.
|
||||
|
||||
QrCode::generate('Make me into a QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### 포맷(Format) 변경
|
||||
|
||||
>Qr코드를 생성하면 기본적으로 SVG 이미지가 반환됩니다.
|
||||
|
||||
>주의하세요! `format` 메소드는 `size`, `color`, `backgroundColor`, 그리고 `margin`과 같은 다른 포맷팅 옵션들보다 먼저 호출되어야 합니다.
|
||||
|
||||
현재는 PNG, EPS, 그리고 SVG 이 세 가지 포맷을 지원하고 있습니다. 포맷을 변경하려면 아래의 코드를 참고하세요:
|
||||
|
||||
QrCode::format('png'); //Will return a PNG image
|
||||
QrCode::format('eps'); //Will return a EPS image
|
||||
QrCode::format('svg'); //Will return a SVG image
|
||||
|
||||
#### 크기 변경
|
||||
|
||||
>Qr코드를 생성하면 기본적으로 Qr코드를 만들기 위한 최소 픽셀 사이즈로 반환됩니다.
|
||||
|
||||
`size` 메소드를 사용하면 Qr코드의 크기를 변경할 수 있습니다. 아래의 코드처럼, 단순히 원하는 픽셀 사이즈를 입력하세요:
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
#### 색 변경
|
||||
|
||||
>Qr코드의 색을 변경할 때는 주의하세요. 어떤 Qr리더들은 색이 입혀진 Qr코드를 잘 읽지 못합니다.
|
||||
|
||||
모든 색은 RGB (Red Green Blue)로 표현되어야 합니다. 아래의 코드와 같이 Qr코드의 색을 변경할 수 있습니다:
|
||||
|
||||
QrCode::color(255,0,255);
|
||||
|
||||
배경색도 변경할 수 있고, 같은 표현 방법을 사용합니다.
|
||||
|
||||
QrCode::backgroundColor(255,255,0);
|
||||
|
||||
#### 여백(Margin) 변경
|
||||
|
||||
Qr코드 주위의 여백을 변경하는 것 또한 가능합니다. 아래의 코드처럼, 단순히 원하는 여백을 입력하세요:
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### 오류 복원(Error Correction)
|
||||
|
||||
오류 복원 레벨을 변경하는 것은 쉽습니다. 아래의 코드를 참고하세요:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
아래는 `errorCorrection` 메소드에서 지원하는 옵션들입니다.
|
||||
|
||||
| 오류 복원 레벨 | 복원률 |
|
||||
| --- | --- |
|
||||
| L | 약 7%의 codewords |
|
||||
| M | 약 15%의 codewords |
|
||||
| Q | 약 25%의 codewords |
|
||||
| H | 약 30%의 codewords |
|
||||
|
||||
>codewords는 데이터를 구성하는 단위로 Qr코드에는 8bit/codewords를 의미합니다.
|
||||
|
||||
>복원율이 커질 수록 Qr코드가 커지고 저장할 수 있는 데이터가 적어집니다. [error correction](http://en.wikipedia.org/wiki/QR_code#Error_correction)를 참고하세요.
|
||||
|
||||
#### 인코딩(Encoding)
|
||||
|
||||
Qr코드를 만들기 위한 문자 인코딩을 변경할 수 있습니다. 기본값은 `ISO-8859-1`입니다. [character encoding](http://en.wikipedia.org/wiki/Character_encoding)를 참고하세요. 아래의 코드처럼, 다른 인코딩으로 변경할 수 있습니다:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Make me a QrCode with special symbols ♠♥!!');
|
||||
|
||||
| 문자 인코더(Character Encoder) |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
>`Could not encode content to ISO-8859-1` 오류는 잘못된 문자 인코딩이 사용되고 있다는 것을 의미합니다. 만약 확신이 없다면 `UTF-8` 사용을 권장합니다.
|
||||
|
||||
#### 병합(Merge)
|
||||
|
||||
`merge` 메소드는 이미지를 Qr코드 위에 합쳐줍니다. 주로 로고 이미지를 Qr코드 안에 넣기 위해 사용합니다.
|
||||
|
||||
QrCode::merge($filename, $percentage, $absolute);
|
||||
|
||||
//Generates a QrCode with an image centered in the middle.
|
||||
QrCode::format('png')->merge('path-to-image.png')->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
|
||||
>`merge` 메소드는 현재 PNG 포맷만 지원합니다.
|
||||
>`$absolute`가 `false`로 되어 있으면, 파일 경로는 상대 경로입니다. 절대 경로를 사용하고 싶으시면, 이 변수 값을 `true`로 변경해주세요.
|
||||
|
||||
>`merge`를 사용하면서 Qr리더가 잘 스캔하게 하기 위해서는 높은 오류 복원율을 사용해야합니다. `errorCorrection('H')`를 사용하기를 권장합니다.
|
||||
|
||||

|
||||
|
||||
#### 이진 문자열 병합(Merge Binary String)
|
||||
|
||||
`mergeString` 메소드는 `merge`와 동일한 동작을 합니다. 단, `mergeString` 메소드를 사용하면 파일을 파일의 경로가 아닌 문자열로 표현할 수 있도록 해줍니다. 이는 `Storage` 파사드를 같이 사용할 때, 유용하게 쓰입니다. `mergeString`의 인터페이스는 `merge`와 거의 동일합니다.
|
||||
|
||||
QrCode::mergeString(Storage::get('path/to/image.png'), $percentage);
|
||||
|
||||
//Generates a QrCode with an image centered in the middle.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
|
||||
|
||||
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
|
||||
|
||||
>일반적인 `merge` 메소드 호출처럼, 현재 PNG 포맷만 지원합니다. 오류 복원율도 동일하게 높은 레벨의 오류 복원율을 권장합니다.
|
||||
|
||||
#### 고급(Advanced) 사용법
|
||||
|
||||
모든 메소드는 메소드 체이닝을 지원합니다. `generate` 메소드는 반드시 마지막에 호출되어야 하고, `format` 변경은 반드시 첫 부분에 호출되어야 합니다. 아래의 예시 코드를 참고해주세요:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Make me a QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Make me a QrCode!');
|
||||
|
||||
PNG 이미지를 `base64_encode`를 사용하여 인코딩된 raw string을 사용하면, 파일로 저장하지 않아도 출력할 수 있습니다.
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Make me into an QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## 헬퍼(Helpers)
|
||||
|
||||
#### 헬퍼가 무엇인가요?
|
||||
|
||||
헬퍼는 Qr리더로 스캔했을 때, 특정한 동작을 할 수 있는 Qr코드를 만들어줍니다.
|
||||
|
||||
#### 비트코인(BitCoin)
|
||||
|
||||
이 헬퍼는 스캔했을 때 비트코인을 송금할 수 있는 Qr코드를 만들어줍니다. [더 알아보기](https://bitco.in/en/developer-guide#plain-text)
|
||||
|
||||
QrCode::BTC($address, $amount);
|
||||
|
||||
//Sends a 0.334BTC payment to the address
|
||||
QrCode::BTC('bitcoin address', 0.334);
|
||||
|
||||
//Sends a 0.334BTC payment to the address with some optional arguments
|
||||
QrCode::size(500)->BTC('address', 0.0034, [
|
||||
'label' => 'my label',
|
||||
'message' => 'my message',
|
||||
'returnAddress' => 'https://www.returnaddress.com'
|
||||
]);
|
||||
|
||||
#### 이메일(E-mail)
|
||||
|
||||
이 헬퍼는 이메일 주소, 제목, 그리고 내용이 미리 입력되어 있는 채로 이메일을 보낼 수 있는 Qr코드를 만들어줍니다.
|
||||
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
//Fills in the to address
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
//Fills in the to address, subject, and body of an e-mail.
|
||||
QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');
|
||||
|
||||
//Fills in just the subject and body of an e-mail.
|
||||
QrCode::email(null, 'This is the subject.', 'This is the message body.');
|
||||
|
||||
#### 지리위치(Geo)
|
||||
|
||||
이 헬퍼는 스마트폰으로 스캔해서 구글 지도 같은 지도 앱들에 위치를 표현할 수 있도록 위도와 경도 값을 포함하고 있는 Qr코드를 만들어줍니다.
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### 전화번호(Phone Number)
|
||||
|
||||
이 헬퍼는 스캔해서 통화 연결을 할 수 있는 Qr코드를 만들어줍니다.
|
||||
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### 문자 메세지(SMS)
|
||||
|
||||
이 헬퍼는 받는 사람 번호와 문자 메세지 내용이 미리 입력되어 있는 채로 문자 메세지를 보낼 수 있는 Qr코드를 만들어줍니다.
|
||||
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
//Creates a text message with the number filled in.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
//Creates a text message with the number and message filled in.
|
||||
QrCode::SMS('555-555-5555', 'Body of the message');
|
||||
|
||||
#### 와이파이(WiFi)
|
||||
|
||||
이 헬퍼는 스마트폰으로 스캔해서 와이파이에 연결할 수 있도록 하는 Qr코드를 만들어줍니다.
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID of the network',
|
||||
'password' => 'Password of the network',
|
||||
'hidden' => 'Whether the network is a hidden SSID or not.'
|
||||
]);
|
||||
|
||||
//Connects to an open WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
]);
|
||||
|
||||
//Connects to an open, hidden WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
//Connects to an secured, WiFi network.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Network Name',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'myPassword'
|
||||
]);
|
||||
|
||||
>현재 애플 제품(예. 아이폰 등)은 와이파이 스캔을 지원하지 않습니다.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
## 사용 예시(Common QrCode Usage)
|
||||
|
||||
아래 표에 있는 접두사(prefix)를 `generate` 섹션에 사용하면, 더 고급스러운 정보가 저장된 Qr코드를 만들 수 있습니다:
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| 사용처 | Prefix | 예시 |
|
||||
| --- | --- | --- |
|
||||
| 웹사이트(http) URL | http:// | http://www.simplesoftware.io |
|
||||
| 웹사이트(https) URL | https:// | https://www.simplesoftware.io |
|
||||
| 이메일 주소 | mailto: | mailto:support@simplesoftware.io |
|
||||
| 전화번호 | tel: | tel:555-555-5555 |
|
||||
| 문자 메세지(SMS) | sms: | sms:555-555-5555 |
|
||||
| 내용이 미리 입력된 문자 메세지(SMS) | sms: | sms::I am a pretyped message |
|
||||
| 번호와 내용이 미리 입력된 문자 메세지(SMS) | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| 지리위치 정보(Geo Address) | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
|
||||
| 와이파이(Wifi) | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
## 라라벨을 사용하지 않는 곳에서 사용하기(Usage Outside of Laravel)
|
||||
|
||||
`BaconQrCodeGenerator` 클래스를 인스턴스화하면, 라라벨을 사용하지 않는 곳에서 이 패키지를 사용할 수 있습니다.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Make a qrcode without Laravel!');
|
||||
341
vendor/simplesoftwareio/simple-qrcode/docs/pt-br/README.md
vendored
Normal file
@@ -0,0 +1,341 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
|
||||
- [Introdução](#docs-introduction)
|
||||
- [Traduções](#docs-translations)
|
||||
- [Configuração](#docs-configuration)
|
||||
- [Simples ideias](#docs-ideas)
|
||||
- [Uso](#docs-usage)
|
||||
- [Ajuda](#docs-ajudantes)
|
||||
- [Uso comum do QrCode](#docs-common-usage)
|
||||
- [Uso sem Laravel](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## Introdução
|
||||
Simple QrCode é um pacote de fácil uso do Framework Laravel, baseado no grande trabalho do [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). Criamos uma interface que é fácil e familiar de instalar para usuários Laravel.
|
||||
|
||||
<a id="docs-translations"></a>
|
||||
## Traduções
|
||||
Estamos procurando por usuários que falem Árabe, Espanhol, Francês, Coreano ou Japonês, para nos ajudar a traduzir este documento. Por favor, crie um pull request se você é capar de fazer uma tradução!
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## Configuração
|
||||
|
||||
#### Composer
|
||||
|
||||
Primeiramente, adicione o pacote Simple QrCode ao seu `require` no arquivo `composer.json`:
|
||||
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~2"
|
||||
}
|
||||
|
||||
Em seguida, execute o comando `composer update`.
|
||||
|
||||
#### Provedor de Serviço
|
||||
|
||||
###### Laravel <= 5.4
|
||||
Registre a `SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class` em seu `config/app.php` dentro do array `providers`.
|
||||
|
||||
#### Aliases
|
||||
|
||||
###### Laravel <= 5.4
|
||||
Finalmente, adicione `'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class` em seu arquivo de configuração `config/app.php` dentro do array `aliases`.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## Ideias simples
|
||||
|
||||
#### Print View
|
||||
|
||||
Um dos principais pontos pelo qual nós utilizamos este pacote para é ter QRCodes em todos os nossos pontos de vista de impressão. Isto permite que nossos clientes possam retornar para a página original depois da impressão, basta digitalizar o código. Conseguimos isso adicionando o seguinte em nosso arquivo footer.blade.php.
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Me escaneie para retornar à página principal</p>
|
||||
</div>
|
||||
|
||||
#### Embarcando um QrCode
|
||||
|
||||
Você pode incorporar um qrcode dentro de um e-mail, que permita que seus usuários escaneiem rapidamente. Abaixo, um exemplo de como fazer isso utilizando o Laravel.
|
||||
|
||||
//Inside of a blade template.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Anexe-me em um e-mail!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## Uso
|
||||
|
||||
#### Uso Básico
|
||||
|
||||
É muito fácil utilizar o gerador de Qrcode. A sintaxe mais básica é:
|
||||
|
||||
QrCode::generate('Me transforme em um QrCode!');
|
||||
|
||||
Isso criará um Qr que diz "Me transforme em um QrCode!"
|
||||
|
||||
#### Generate
|
||||
|
||||
`Generate` é usado para criar o QrCode.
|
||||
|
||||
QrCode::generate('Me transforme em um QrCode!');
|
||||
|
||||
>Atenção! Esse método deve ser chamado por último dentro da cadeia.
|
||||
|
||||
`Generate` por padrão irá retornar uma string de imagem SVG. Você pode exibir diretamente em seu browser, utilizando o Laravel's Blade com o código abaixo:
|
||||
|
||||
{!! QrCode::generate('Me transforme em um QrCode!'); !!}
|
||||
|
||||
O método `generate` tem um segundo parametro que aceita um arquivo e um path para salvar o Qrcode.
|
||||
|
||||
QrCode::generate('Me transforme em um QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### Alteração de Formato
|
||||
|
||||
>Por padrão o gerador de QrCode está configurado para retornar uma imagem SVG.
|
||||
|
||||
>Cuidao! O método `format` deve ser chamado antes de qualquer outra opção de formatação como `size`, `color`, `backgroundColor` e `margin`.
|
||||
|
||||
Atualmente são suportados três tipos de formatos; PNG, EPS, and SVG. Para alterar o formato, use o seguinte código:
|
||||
|
||||
QrCode::format('png'); // Retornará uma imagem no formato PNG
|
||||
QrCode::format('eps'); // Retornará uma imagem no formato EPS
|
||||
QrCode::format('svg'); // Retornará uma imagem no formato SVG
|
||||
|
||||
#### Alteração de Tamanho
|
||||
|
||||
>Por padrão, o gerador QrCode retornará o menos tamanho possível em pixels para criar o QrCode.
|
||||
|
||||
Você pode alterar o tamanho do QrCode usando o método `size`. Simplesmente especifique o tamanho desejado em pixels usando a seguinte sintaze:
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
#### Alteração de cor
|
||||
|
||||
>Cuidado quando estiver alterando a cor de um QRCode. Alguns leitores tem uma grande dificuldade em ler QrCodes coloridos.
|
||||
|
||||
Todas as cores devem ser definidas em RGB(Red Green Blue). Você pode alterar a cor de um qrCode usando o código abaixo:
|
||||
|
||||
QrCode::color(255,0,255);
|
||||
|
||||
Alterações do plano de fundo também são suportadas e definidas da mesma maneira.
|
||||
|
||||
QrCode::backgroundColor(255,255,0);
|
||||
|
||||
#### Alteração de Margem
|
||||
|
||||
A capacidade de alterar a margem ao redor do QrCode também é suportada. Simplesmente especifique o tamanho desejado da margem, utilizando a sintaxe abaixo:
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### Correção de erros
|
||||
|
||||
Alterar o nível de correção de erros é simples. Utilize a seguinte sintaxe:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
As seguintes opções são suportadas para o método `errorCorrection`.
|
||||
|
||||
| Correção de erros | Garantia fornecida |
|
||||
| --- | --- |
|
||||
| L | 7% das palavras-código podem ser restauradas. |
|
||||
| M | 15% das palavras-código podem ser restauradas. |
|
||||
| Q | 25% das palavras-código podem ser restauradas. |
|
||||
| H | 30% das palavras-código podem ser restauradas. |
|
||||
|
||||
>Quanto maior a correção de erros utilizada, maior o QrCode fica e menos informação ele pode armazenar. Leia mais sobre [correção de erros](http://en.wikipedia.org/wiki/QR_code#Error_correction).
|
||||
|
||||
#### Codificação
|
||||
|
||||
Alterar a codificação que é usada para criar um QrCode. Por padrão, a encodificação padrão é a `ISO-8859-1`. Leia mais sobre [codificação de caracteres](https://pt.wikipedia.org/wiki/Codifica%C3%A7%C3%A3o_de_caracteres). Você pode alterar a codificação usando o seguinte código:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Faça-me um QrCode com símbolos especiais ♠♥!!');
|
||||
|
||||
| Codificador de caracteres |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
>Um erro de `Could not encode content to ISO-8859-1` significa que foi inserido algum caractere inválido. Recomendamos o `UTF-8` se você não tiver certeza.
|
||||
|
||||
#### Mesclar
|
||||
|
||||
O método `merge` mescla uma imagem sobre um Qrcode. É comumente usado para se colocar logos dentro de um QrCode.
|
||||
|
||||
QrCode::merge($filename, $percentage, $absolute);
|
||||
|
||||
// Gera um QrCode com uma imagem centralizada.
|
||||
QrCode::format('png')->merge('diretório/da/imagem.png')->generate();
|
||||
|
||||
// Gera um QrCode com uma imagem centralizada. A imagem inserida ocupará 30% do QrCode.
|
||||
QrCode::format('png')->merge('diretório/da/imagem.png', .3)->generate();
|
||||
|
||||
// Gera um QrCode com uma imagem centralizada. A imagem inserida ocupará 30% do QrCode.
|
||||
QrCode::format('png')->merge('http://www.google.com/algumaImagem.png', .3, true)->generate();
|
||||
|
||||
>O método `merge` suporta somente arquivos do tipo PNG.
|
||||
>O diretório da imagem é relativo ao caminho base da aplicação, se o `$absolute` estiver setada para `false`. Altere essa variável para `true` para usar caminhos absolutos.
|
||||
|
||||
>Você deve usar um alto nível de correção de erros quando usado o método `merge`, para garantir que o QrCode será legível. Recomendamos usar `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
#### Funda string binária
|
||||
|
||||
O método `mergeString` pode ser usado para alcançar a mesma chamada do método `merge`, exceto que ele permite que você represente uma string de um arquivo ao invés do diretório. Isso é útil quando é utilizado o padrão `Storage`. A chamada a essa interface é bastante similar ao método `merge`.
|
||||
|
||||
QrCode::mergeString(Storage::get('diretório/da/imagem.png'), $percentage);
|
||||
|
||||
// Gera um QrCode com uma imagem centralizada.
|
||||
QrCode::format('png')->mergeString(Storage::get('diretório/da/imagem.png'))->generate();
|
||||
|
||||
// Gera um QrCode com uma imagem centralizada. A imagem inserida ocupará 30% do QrCode.
|
||||
QrCode::format('png')->mergeString(Storage::get('diretório/da/imagem.png'), .3)->generate();
|
||||
|
||||
>Assim como o método `merge`, somente arquivos do tipo PNG são suportados. O mesmo aplica-se para correção de erros, altos níveis são recomendados.
|
||||
|
||||
#### Uso Avançado
|
||||
|
||||
Todos os métodos suportam encadeamento. O método `generate` deve ser chamado por último e o método `format` deve ser chamado primeiro. Por exemplo, vocẽ pode executar o código seguinte:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Faça-me um QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Faça-me um QrCode!');
|
||||
|
||||
Você pode exibir uma imagem PNG, sem salvar o arquivo e prover uma string encodificada pelo método `base64_encode`.
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Crie-me dentro de um QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-ajudantes"></a>
|
||||
## Ajudantes
|
||||
|
||||
#### O que são ajudantes?
|
||||
|
||||
Ajudantes são uma maneira fácil de criar QrCodes que executam uma ação quando escaneados.
|
||||
|
||||
#### E-Mail
|
||||
|
||||
Esse ajudante, gera um qrcode de e-mail que é capaz de ser preenchido no endereço de e-mail, assunto e corpo.
|
||||
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
// Preenche o endereço de email
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
// Preenche o endereço, título e corpo de um email
|
||||
QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');
|
||||
|
||||
// Preenche apenas o título e corpo de um email
|
||||
QrCode::email(null, 'This is the subject.', 'This is the message body.');
|
||||
|
||||
#### Geo
|
||||
|
||||
Esse ajudante gera uma latitude e longitude que pode ser lido por um aparelho celular e abrir a localização no Google maps ou outro aplicativo similar.
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### Phone Number
|
||||
|
||||
Esse ajudante, gera uma QrCode que pode ser escaneado e exibir um número de telefone.
|
||||
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### SMS (Mensagens de Texto)
|
||||
|
||||
Esse ajudante, cria uma mensagem SMS que pode ser preenchida com o número de telefone e o corpo da mensagem.
|
||||
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
// Cria uma mensagem de texto com o telefone preenchido.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
// Cria uma mensagem de texto com o número telefônico e a mensagem preenchida.
|
||||
QrCode::SMS('555-555-5555', 'Body of the message');
|
||||
|
||||
#### WiFi
|
||||
|
||||
Esse ajudante, faz com que QrCodes escaneáveis permitam o aparelho celular se conectar a uma rede WI-FI.
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'SSID da rede',
|
||||
'password' => 'Senha da rede',
|
||||
'hidden' => 'Se a rede é um SSID oculto ou não.'
|
||||
]);
|
||||
|
||||
// Conectar a uma rede wifi
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nome da rede',
|
||||
]);
|
||||
|
||||
// Conectar a uma refe wifi oculta
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nome da rede',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
// Conectar a uma rede wifi segura
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Nome da rede',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'minhaSenha'
|
||||
]);
|
||||
|
||||
>Escaneamento WIFI atualmente não são suportados nos produtos Apple.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
##Uso Comum do QRCode
|
||||
|
||||
Você pode usar um prefixo listado na tabela abaixo dentro da seção `generate` para criar um QrCode para armazenar informações mais avançadas:
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| Uso | Prefixo | Exemplo |
|
||||
| --- | --- | --- |
|
||||
| URL do site | http:// | http://www.simplesoftware.io |
|
||||
| URL segura | https:// | https://www.simplesoftware.io |
|
||||
| Endereço de e-mail | mailto: | mailto:support@simplesoftware.io |
|
||||
| Número de telefone | tel: | tel:555-555-5555 |
|
||||
| Texto (SMS) | sms: | sms:555-555-5555 |
|
||||
| Texto (SMS) With Pretyped Message | sms: | sms::I am a pretyped message |
|
||||
| Texto (SMS) With Pretyped Message and Number | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| Coordenadas | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard | BEGIN:VCARD | [Veja Exemplos](https://en.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
##Uso fora do Laravel
|
||||
|
||||
Você pode usar o pacote fora do Laravel instanciando a classe `BaconQrCodeGenerator`.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Crie um QrCode sem Laravel!');
|
||||
438
vendor/simplesoftwareio/simple-qrcode/docs/ru/README.md
vendored
Normal file
@@ -0,0 +1,438 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
|
||||
- [Введение](#docs-introduction)
|
||||
- [Переводы](#docs-translations)
|
||||
- [Конфигурация](#docs-configuration)
|
||||
- [Простые Идеи](#docs-ideas)
|
||||
- [Использование](#docs-usage)
|
||||
- [Хелперы](#docs-helpers)
|
||||
- [Префиксы](#docs-common-usage)
|
||||
- [Использование без Laravel](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## Введение
|
||||
|
||||
Simple QrCode - простая в использовании обёртка для популярного фреймворка Laravel на основе превосходного проекта [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode).
|
||||
Мы создали интерфейс, который привычен и прост в установке для пользователей Laravel.
|
||||
|
||||
<a id="docs-translations"></a>
|
||||
## Переводы
|
||||
|
||||
Мы ищем пользователей, говорящих на китайском, корейском или японском языках, которые могут помочь перевести этот документ.
|
||||
Пожалуйста, создайте пул реквест, если вы можете сделать перевод!
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## Конфигурация
|
||||
|
||||
### Composer
|
||||
|
||||
Находясь в директории вашего проекта laravel, выполните команду:
|
||||
|
||||
```bash
|
||||
composer require simplesoftwareio/simple-qrcode
|
||||
```
|
||||
|
||||
Либо добавьте пакет `simplesoftwareio/simple-qrcode` в раздел `require` файла `composer.json`:
|
||||
|
||||
```json
|
||||
"require": {
|
||||
"simplesoftwareio/simple-qrcode": "~2"
|
||||
}
|
||||
```
|
||||
|
||||
Затем запустите команду `composer update`.
|
||||
|
||||
### Поставщик услуг (Laravel <= 5.4)
|
||||
|
||||
Добавьте строчку
|
||||
```
|
||||
SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class
|
||||
```
|
||||
в конец массива `providers` в файле `config/app.php`.
|
||||
|
||||
### Алиас (Laravel <= 5.4)
|
||||
|
||||
Добавьте строчку
|
||||
```
|
||||
'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class
|
||||
```
|
||||
в конец массива `aliases` в файле `config/app.php`.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## Простые Идеи
|
||||
|
||||
### Печать страниц
|
||||
|
||||
Мы используем QR-коды на страница для печати.
|
||||
Это позволяет нашим клиентам открыть исходную страницу на устройстве после печати, просто отсканировав этот код.
|
||||
Для этого в файл `footer.blade.php` мы добавили следующий код:
|
||||
|
||||
```blade
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>Отсканируйте QR-код, чтобы открыть исходную страницу</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Вставка QR-кода в email
|
||||
|
||||
Вы можете вставить QR-код в email, чтобы позволить пользователям быстро его отсканировать.
|
||||
Ниже приведен пример того, как сделать это с помощью Laravel:
|
||||
|
||||
```blade
|
||||
// внутри шаблона blade
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Введете меня в сообщение по электронный почте!'), 'QrCode.png', 'image/png')!!}">
|
||||
```
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## Использование
|
||||
|
||||
### Общий случай использования
|
||||
|
||||
Использовать генератор для QR-код очень легко.
|
||||
Достаточно вызвать один метод:
|
||||
|
||||
```php
|
||||
QrCode::generate('Lorem ipsum!');
|
||||
```
|
||||
|
||||
Этот код создаст QR-код с текстом "Lorem ipsum!".
|
||||
|
||||
### Генерация изображений
|
||||
|
||||
Используйте метод `generate()`, чтобы создать изображение QR-кода:
|
||||
|
||||
```php
|
||||
QrCode::generate('Lorem ipsum!');
|
||||
```
|
||||
|
||||
> Внимание! При вызове в цепочке методов этот метод должен вызываться в конце.
|
||||
|
||||
Метод `generate()` по умолчанию возвращает строку, содержащую SVG-представление изображения.
|
||||
Поэтому её можно вывести как есть прямо в браузер внутри Blade-шаблона:
|
||||
|
||||
```blade
|
||||
{!! QrCode::generate('Lorem ipsum!'); !!}
|
||||
```
|
||||
|
||||
Чтобы сохранить изображение QR-кода в файл, передайте методу `generate()` путь к файлу вторым аргументом:
|
||||
|
||||
```blade
|
||||
QrCode::generate('Lorem ipsum!', '../public/qrcodes/qrcode.svg');
|
||||
```
|
||||
|
||||
### Изменение формата
|
||||
|
||||
> По умолчанию QR-код создаётся в формате SVG.
|
||||
|
||||
> **Обратите внимание!** Метод `format()` должен вызываться **перед** всеми остальными методами форматирования, такими как `size()`, `color()`, `backgroundColor()` и `margin()`.
|
||||
|
||||
На данный момент поддерживаются три формата: PNG, EPS и SVG.
|
||||
Для изменения формата используйте следующий код:
|
||||
|
||||
```php
|
||||
QrCode::format('png');
|
||||
QrCode::format('eps');
|
||||
QrCode::format('svg');
|
||||
```
|
||||
|
||||
### Изменение размера
|
||||
|
||||
> По умолчанию QR-код создаётся наименьшего размера.
|
||||
|
||||
Вы можете изменить размер QR-код с помощью метода `size()`.
|
||||
Просто укажите размер желаемого в пикселях, используя следующий синтаксис:
|
||||
|
||||
```php
|
||||
QrCode::size(100);
|
||||
```
|
||||
|
||||
### Изменение цветов
|
||||
|
||||
> Будьте осторожны при изменении цветов QR-кода.
|
||||
> Это может затруднить его сканирование.
|
||||
|
||||
Вы можете изменить цвет клеток на изображении.
|
||||
Для этого следует использовать метод `color()`.
|
||||
Три аргумента этого метода - значения RGB-палитры соответственно.
|
||||
|
||||
Например, так можно сделать клетки розовыми:
|
||||
|
||||
```php
|
||||
QrCode::color(255, 0, 255);
|
||||
```
|
||||
|
||||
Также поддерживается изменение цвета фона методом `backgroundColor()`.
|
||||
Например, следующий код сделает фон не белым, а жёлтым:
|
||||
|
||||
```php
|
||||
QrCode::backgroundColor(255, 255, 0);
|
||||
```
|
||||
|
||||
### Поля
|
||||
|
||||
Вы можете изменить внутренние поля изображения.
|
||||
Это поможет повысить вероятность успешного сканирования.
|
||||
|
||||
Просто укажите количество пикселей между краем изображения и матрицей:
|
||||
|
||||
```php
|
||||
QrCode::margin(100);
|
||||
```
|
||||
|
||||
### Уровень коррекции ошибок
|
||||
|
||||
Для изменения уровня коррекции ошибок используйте следующий метод:
|
||||
|
||||
```php
|
||||
QrCode::errorCorrection('H');
|
||||
```
|
||||
|
||||
Метод `errorCorrection()` поддерживает следующие уровни:
|
||||
|
||||
| Уровень | Допуск ошибок |
|
||||
| ------- | ------------- |
|
||||
| L | 7% |
|
||||
| M | 15% |
|
||||
| Q | 25% |
|
||||
| H | 30% |
|
||||
|
||||
> Чем выше уровень коррекции, тем больше становится QR-код и тем меньше данных он может хранить.
|
||||
> [Подробнее](https://ru.wikipedia.org/wiki/QR-%D0%BA%D0%BE%D0%B4#.D0.9E.D0.B1.D1.89.D0.B0.D1.8F_.D1.82.D0.B5.D1.85.D0.BD.D0.B8.D1.87.D0.B5.D1.81.D0.BA.D0.B0.D1.8F_.D0.B8.D0.BD.D1.84.D0.BE.D1.80.D0.BC.D0.B0.D1.86.D0.B8.D1.8F).
|
||||
|
||||
### Кодировка символов
|
||||
|
||||
По умолчанию используется кодировка `ISO-8859-1`.
|
||||
[Подробнее о кодировках символов](https://ru.wikipedia.org/wiki/%D0%9D%D0%B0%D0%B1%D0%BE%D1%80_%D1%81%D0%B8%D0%BC%D0%B2%D0%BE%D0%BB%D0%BE%D0%B2).
|
||||
|
||||
Вы можете кодировку, используя метод `encoding()`:
|
||||
|
||||
```php
|
||||
QrCode::encoding('UTF-8')->generate('‘Lorem ipsum со специальными символами ♠♥!!');
|
||||
```
|
||||
|
||||
Полный список поддерживаемых кодировок:
|
||||
|
||||
| Кодировка |
|
||||
| ------------ |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
> Ошибка `Could not encode content to ISO-8859-1` означает, что вы передали в метод `generate()` строку, символы которой невозможно перевести в ISO-8859-1.
|
||||
> Если вы не уверены какую кодировку использовать в вашем случае, то перед вызовом `generate()` установите кодировку `UTF-8`.
|
||||
|
||||
### Наложение изображений на QR-код (из файла)
|
||||
|
||||
Метод `merge()` накладывает указанное изображение на QR-код.
|
||||
Это обычно используется для логотипов, размащаемых в пределах QR-кода.
|
||||
|
||||
```php
|
||||
QrCode::merge($filename, $percentage, $absolute);
|
||||
|
||||
// Создает QR-код с изображением в центре
|
||||
QrCode::format('png')->merge('path-to-image.png')->generate();
|
||||
|
||||
// Создает QR-код с изображением в центре
|
||||
// Вставленное изображение занимает 30% QR-кода
|
||||
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
```
|
||||
|
||||
> На данный момент метод `merge()` поддерживает только PNG.
|
||||
|
||||
> По умолчанию путь к файлу считается относительно `base_path()` вашего проекта.
|
||||
> Если вы указываете абсолютный путь к файлу, то передайте `true` третьим аргументом.
|
||||
|
||||
> Вы должны использовать высокий уровень коррекции ошибок при использовании метода `merge()` чтобы QR-код остался читаемым.
|
||||
> Рекомендуется использовать `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
### Наложение изображений на QR-код (из двоичной строки)
|
||||
|
||||
Метод `mergeString()` может быть использован для решения той же задачи, что и `merge()`.
|
||||
Отличие в том, что `mergeString()` принимает строковое представление файла вместо пути к файлу.
|
||||
Это полезно при работе с фасадом `Storage`.
|
||||
Этот интерфейс очень похож на вызов `merge()`.
|
||||
|
||||
> Как и в случае с `merge()`, здесь поддерживается только PNG-формат.
|
||||
> То же самое относится к коррекции ошибок - рекомендуется использовать высокие уровни.
|
||||
|
||||
### Дополнительный функционал
|
||||
|
||||
Все методы поддерживают последовательный вызов.
|
||||
|
||||
Вызывайте метод `generate()` в последнюю очередь, после применения форматирования.
|
||||
|
||||
Примеры последовательных вызовов:
|
||||
|
||||
```php
|
||||
QrCode::size(250)
|
||||
->color(150, 90, 10)
|
||||
->backgroundColor(10, 14, 244)
|
||||
->generate('Lorem ipsum!');
|
||||
QrCode::format('png')
|
||||
->size(399)
|
||||
->color(40, 40, 40)
|
||||
->generate('Lorem ipsum!');
|
||||
```
|
||||
|
||||
Вы можете отобразить в браузере PNG-изображение без его сохранения в файл, выводя закодированную при помощи `base64_encode()` необработанную строку:
|
||||
|
||||
```blade
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Lorem ipsum!')) !!} ">
|
||||
```
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## Хелперы
|
||||
|
||||
### Что такое хелперы?
|
||||
|
||||
Хелперы предоставляют простой способ создания QR-кода, который заставляет сканер пользователя выполнить определенное действие.
|
||||
|
||||
### Электронная Почта
|
||||
|
||||
Этот хелпер генерирует QR-код для создания email.
|
||||
Можно указать email адресата, тему и текст письма.
|
||||
|
||||
```php
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
// Заполняет адресата
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
// Заполняет адресата, тему и текст сообщения электронной почты.
|
||||
QrCode::email('foo@bar.com', 'Это тема', 'Это текст');
|
||||
|
||||
// Заполняет только тему и текст сообщения электронной почты.
|
||||
QrCode::email(null, 'Это тема', 'Это текст');
|
||||
```
|
||||
|
||||
### Geo
|
||||
|
||||
Этот хелпер генерирует QR-код с координатами точки на карте.
|
||||
Для этого нужно указать её широту и долготу.
|
||||
Смартфон пользователя может открыть указанное местоположение в Google Maps или другом приложении карт.
|
||||
|
||||
```php
|
||||
QrCode::geo($latitude, $longitude);
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
```
|
||||
|
||||
### Номер телефона
|
||||
|
||||
Этот хелпер генерирует QR-код, при помощи которого можно быстро совершить звонок:
|
||||
|
||||
```php
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
```
|
||||
|
||||
### СМС
|
||||
|
||||
Этот хелпер создаёт СМС-сообщение, в котором уже может быть указан номер телефона адресата и текст сообщения:
|
||||
|
||||
```php
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
// Создает СМС, где номер телефона уже заполнен.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
// Создает СМС, где номер и текст уже заполнены.
|
||||
QrCode::SMS('555-555-5555', 'текст сообщения.');
|
||||
```
|
||||
|
||||
### WiFi
|
||||
|
||||
Эти хелперы создают QR-коды, которые помогут подключить смартфон к Wi-Fi:
|
||||
|
||||
```php
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => 'идентификатор сети (SSID)',
|
||||
'password' => 'пароль сети',
|
||||
'hidden' => 'является ли сеть скрытой (true/false)'
|
||||
]);
|
||||
|
||||
// Подключается к открытой сети WiFi.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Имя сети',
|
||||
]);
|
||||
|
||||
// Подключается к открытой или скрытой сети WiFi.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Имя сети',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
// Подключается к защищенной сети.
|
||||
QrCode::wiFi([
|
||||
'ssid' => 'Имя сети',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'Мой пароль'
|
||||
]);
|
||||
```
|
||||
|
||||
> Сканирование WiFi в настоящее время не поддерживается устройствами Apple.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
## Префиксы
|
||||
|
||||
Вы можете использовать префиксы вместо хелперов.
|
||||
Составьте строку по образцу, как в таблице ниже, и передайте её в метод `generate()`, чтобы добиться того же эффекта, как при использовании хелперов:
|
||||
|
||||
```php
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
```
|
||||
|
||||
| Применение | Префикс | Пример |
|
||||
| --- | --- | --- |
|
||||
| Ссылка на сайт | http:// | http://www.simplesoftware.io |
|
||||
| Безопасная ссылка | https:// | https://www.simplesoftware.io |
|
||||
| Email | mailto: | mailto:support@simplesoftware.io |
|
||||
| Телефон для звонка | tel: | tel:555-555-5555 |
|
||||
| СМС | sms: | sms:555-555-5555 |
|
||||
| СМС с текстом сообщения | sms: | sms::Какое-то сообщение |
|
||||
| СМС с текстом сообщения и номером адресата | sms: | sms:555-555-5555:Какое-то сообщение |
|
||||
| Местоположение на карте | geo: | geo:-78.400364,-85.916993 |
|
||||
| Визитка (MeCard) | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| Контакт (VCard) | BEGIN:VCARD | [Примеры](https://ru.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
## Использование без Laravel
|
||||
|
||||
Вы можете использовать этот пакет за пределами Laravel, просто создав новый объект класса `BaconQrCodeGenerator`.
|
||||
|
||||
```php
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Создайте QR-код без Laravel!');
|
||||
```
|
||||
405
vendor/simplesoftwareio/simple-qrcode/docs/zh-cn/README.md
vendored
Normal file
@@ -0,0 +1,405 @@
|
||||
[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
|
||||
|
||||
|
||||
- [介绍](#docs-introduction)
|
||||
- [升级指南](#docs-upgrade)
|
||||
- [配置](#docs-configuration)
|
||||
- [简例](#docs-ideas)
|
||||
- [使用说明](#docs-usage)
|
||||
- [助手模板](#docs-helpers)
|
||||
- [QrCode 常规用法](#docs-common-usage)
|
||||
- [在Laravel外的调用方式](#docs-outside-laravel)
|
||||
|
||||
<a id="docs-introduction"></a>
|
||||
## 介绍
|
||||
Simple QrCode 是基于[Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode) 开发,适用于Laravel框架的软件包. 我们的目的是让二维码能更加便捷的使用在Laravel框架的项目里.
|
||||
|
||||
 
|
||||
|
||||
<a id="docs-upgrade"></a>
|
||||
## 升级指南
|
||||
|
||||
从v2版本升到v3需要将 `composer.json` 文件中版本改为 `~3`
|
||||
|
||||
如果你需要使用 `png` 文件格式,那么你**必须**安装 `imagick` PHP扩展.
|
||||
|
||||
<a id="docs-configuration"></a>
|
||||
## 配置
|
||||
|
||||
#### Composer安装
|
||||
|
||||
使用 `composer require simplesoftwareio/simple-qrcode "~3"` 安装软件包,
|
||||
|
||||
Laravel将会自动完成安装工作.
|
||||
|
||||
#### 添加 Service Provider
|
||||
|
||||
###### Laravel <= 5.4
|
||||
注册 `SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class` 至 `config/app.php` 的 `providers` 数组里.
|
||||
|
||||
#### 添加 Aliases
|
||||
|
||||
###### Laravel <= 5.4
|
||||
最后,注册 `'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class` 至 `config/app.php` 的 `aliases` 数组里.
|
||||
|
||||
<a id="docs-ideas"></a>
|
||||
## 简例
|
||||
|
||||
#### 显示视图
|
||||
|
||||
一个重要的应用是在页面中添加来源二维码.这样我们的用户就可以通过扫码返回初始页.我们只需要在 footer.blade.php 文件里添加如下代码即可!
|
||||
|
||||
<div class="visible-print text-center">
|
||||
{!! QrCode::size(100)->generate(Request::url()); !!}
|
||||
<p>扫我返回初始页</p>
|
||||
</div>
|
||||
|
||||
#### 嵌入二维码
|
||||
|
||||
你也可以嵌入二维码在你的邮件中,让收信的用户可以快速扫描.以下是在Laravel中实现的例子:
|
||||
|
||||
//Inside of a blade template.
|
||||
<img src="{!!$message->embedData(QrCode::format('png')->generate('Embed me into an e-mail!'), 'QrCode.png', 'image/png')!!}">
|
||||
|
||||
<a id="docs-usage"></a>
|
||||
## 使用说明
|
||||
|
||||
#### 基本使用
|
||||
使用QrCode的Generator非常方便. 多数情况下只要这样:
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
这就能创建一个内容是:"Make me into a QrCode!" 的二维码了.
|
||||
|
||||
#### 生成 `generate(string $data, string $filename = null)`
|
||||
|
||||
`Generate` 是用来创建二维码的方法.
|
||||
|
||||
QrCode::generate('Make me into a QrCode!');
|
||||
|
||||
>注意:要创建二维码必须使用此方法
|
||||
|
||||
`Generate` 默认返回一个 SVG 格式的图片文本. 你可以直接在Laravel 的 Blade页面 中使用,使用方式如下:
|
||||
|
||||
{!! QrCode::generate('Make me into a QrCode!'); !!}
|
||||
|
||||
`generate` 方法的第二个参数是指定要存储图片数据的文件地址及命名.
|
||||
|
||||
QrCode::generate('Make me into a QrCode!', '../public/qrcodes/qrcode.svg');
|
||||
|
||||
#### 格式 `format(string $format)`
|
||||
|
||||
现支持 PNG,EPS,SVG 三种格式,设置方式如下:
|
||||
|
||||
QrCode::format('png'); //放回PNG图片
|
||||
QrCode::format('eps'); //放回EPS图片
|
||||
QrCode::format('svg'); //放回SVG图片
|
||||
|
||||
> 必须 `imagick` PHP扩展才能生成 `png` 图片.
|
||||
|
||||
#### 尺寸 `size(int $size)`
|
||||
|
||||
>QrCode 的 Generator 默认返回可能最小像素单位的二维码.
|
||||
|
||||
你可以使用 `size` 方法来设置二维码尺寸.下方是设置像素尺寸的方法:
|
||||
|
||||
QrCode::size(100);
|
||||
|
||||
 
|
||||
|
||||
#### 颜色 `color(int $red, int $green, int $blue, int $alpha = null)`
|
||||
|
||||
>注意改变颜色后,可能会导致某些设备难以识别.
|
||||
|
||||
颜色设置的格式必须是RGBA格式. 设置方式如下:
|
||||
|
||||
QrCode::color(255, 0, 0); // 红色二维码
|
||||
QrCode::color(255, 0, 0, 25); //红色二维码+25%透明度
|
||||
|
||||
 
|
||||
|
||||
|
||||
#### 背景颜色 `backgroundColor(int $red, int $green, int $blue, int $alpha = null)`
|
||||
|
||||
你可以使用`backgroundColor` 方法来设置背景颜色.
|
||||
|
||||
QrCode::backgroundColor(255, 0, 0); // 红色背景二维码
|
||||
QrCode::backgroundColor(255, 0, 0, 25); // 红色25%透明背景二维码
|
||||
|
||||
 
|
||||
|
||||
#### 渐变 `gradient($startRed, $startGreen, $startBlue, $endRed, $endGreen, $endBlue, string $type)`
|
||||
|
||||
你可以使用 `gradient` 方法设置渐变.
|
||||
|
||||
支持以下渐变类型:
|
||||
|
||||
| 类型 | 范例 |
|
||||
| --- | --- |
|
||||
| `vertical`垂直 |  |
|
||||
| `horizontal`水平 |  |
|
||||
| `diagonal`对角 |  |
|
||||
| `inverse_diagonal`反对角 |  |
|
||||
| `radial`迳向 |  |
|
||||
|
||||
#### 定位颜色 `eyeColor(int $eyeNumber, int $innerRed, int $innerGreen, int $innerBlue, int $outterRed = 0, int $outterGreen = 0, int $outterBlue = 0)`
|
||||
|
||||
你可以使用 `eyeColor` 方法设置定位眼颜色.
|
||||
|
||||
| 数量 | 范例 |
|
||||
| --- | --- |
|
||||
| `0` |  |
|
||||
| `1` | |
|
||||
| `2` |  |
|
||||
|
||||
#### 风格 `style(string $style, float $size = 0.5)`
|
||||
|
||||
二维码风格可以轻易的使用 `square`, `dot` 或 `round`来调换. 这将改变二维码中的信息块风格. 第二个参数是设置dot'点'的大小和round的圆度.
|
||||
|
||||
| 风格 | 范例 |
|
||||
| --- | --- |
|
||||
| `sqaure`方 |  |
|
||||
| `dot`点 | |
|
||||
| `round`圆 |  |
|
||||
|
||||
#### 定位眼风格 `eyeStyle(string $style)`
|
||||
|
||||
二维码定位眼支持2个格式, `sqaure`方 和 `circle`圆.
|
||||
|
||||
| 风格 | 范例 |
|
||||
| --- | --- |
|
||||
| `sqaure`方 |  |
|
||||
| `circle`圆 | |
|
||||
|
||||
#### 边距 `margin(int $margin)`
|
||||
|
||||
也支持设置边距. 设置方式如下:
|
||||
|
||||
QrCode::margin(100);
|
||||
|
||||
#### 容错级别
|
||||
|
||||
改变二维码的容错级别也很方便. 只要这么设置:
|
||||
|
||||
QrCode::errorCorrection('H');
|
||||
|
||||
下方是 `errorCorrection` 方法支持的容错级别设置.
|
||||
|
||||
| 容错级别 | 说明 |
|
||||
| --- | --- |
|
||||
| L | 7% 的字节码恢复率. |
|
||||
| M | 15% 的字节码恢复率. |
|
||||
| Q | 25% 的字节码恢复率. |
|
||||
| H | 30% 的字节码恢复率. |
|
||||
|
||||
>容错级别越高,二维码越大且能存储的数据越少. 详情见: [error correction](http://en.wikipedia.org/wiki/QR_code#Error_correction).
|
||||
|
||||
#### 编码
|
||||
|
||||
QrCode 创建二维码时可以使用不同的编码. 默认使用 `ISO-8859-1`. 详情见 [character encoding](http://en.wikipedia.org/wiki/Character_encoding) 你可以使用以下的任一种编码:
|
||||
|
||||
QrCode::encoding('UTF-8')->generate('Make me a QrCode with special symbols ♠♥!!');
|
||||
|
||||
| 编码 |
|
||||
| --- |
|
||||
| ISO-8859-1 |
|
||||
| ISO-8859-2 |
|
||||
| ISO-8859-3 |
|
||||
| ISO-8859-4 |
|
||||
| ISO-8859-5 |
|
||||
| ISO-8859-6 |
|
||||
| ISO-8859-7 |
|
||||
| ISO-8859-8 |
|
||||
| ISO-8859-9 |
|
||||
| ISO-8859-10 |
|
||||
| ISO-8859-11 |
|
||||
| ISO-8859-12 |
|
||||
| ISO-8859-13 |
|
||||
| ISO-8859-14 |
|
||||
| ISO-8859-15 |
|
||||
| ISO-8859-16 |
|
||||
| SHIFT-JIS |
|
||||
| WINDOWS-1250 |
|
||||
| WINDOWS-1251 |
|
||||
| WINDOWS-1252 |
|
||||
| WINDOWS-1256 |
|
||||
| UTF-16BE |
|
||||
| UTF-8 |
|
||||
| ASCII |
|
||||
| GBK |
|
||||
| EUC-KR |
|
||||
|
||||
> 若抛出 `Could not encode content to ISO-8859-1` 意味着使用了错误的编码. 我们建议你使用 `UTF-8`.
|
||||
|
||||
#### 合并 `(string $filepath, float $percentage = .2, bool $absolute = false)`
|
||||
|
||||
`merge` 方法可以让QrCode为生成结果加上图片. 常见的用法是在二维码上加Logo.
|
||||
|
||||
//生成中间有图片的二维码
|
||||
QrCode::format('png')->merge('path-to-image.png')->generate();
|
||||
|
||||
//生成中间有图片的二维码,且图片占整个二维码图片的30%.
|
||||
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
|
||||
|
||||
//生成中间有图片的二维码,且图片占整个二维码图片的30%.
|
||||
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
|
||||
|
||||
> `merge` 方法当前只支持PNG格式的图片
|
||||
> 默认使用相对于应用程序的根路径,把第三个参数设置为 `true` 就能切换到使用绝对路径
|
||||
|
||||
> 为了让二维码保持高可识别度,建议在使用 `merge` 方法时把二维码的容错级别提高. 我们推荐使用: `errorCorrection('H')`.
|
||||
|
||||

|
||||
|
||||
#### 二进制合并 `(string $content, float $percentage = .2)`
|
||||
|
||||
`mergeString` 方法与 `merge` 方法类似, 不同的是它允许你使用一个二进制的String代替图片文件. 这在使用 `Storage` 存储时,会显得很方便. 它的参数与 `merge` 类似.
|
||||
|
||||
//生成中间有图片的二维码
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
|
||||
|
||||
//生成中间有图片的二维码,且图片占整个二维码图片的30%.
|
||||
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
|
||||
|
||||
> 和 `merge` 方法一样,当前只支持PNG格式. 同样建议将二维码的容错级别提高.
|
||||
|
||||
#### 高级用法
|
||||
|
||||
所有的方法都支持链式调用. `generate` 方法必须在最后. 例如:
|
||||
|
||||
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Make me a QrCode!');
|
||||
QrCode::format('png')->size(399)->color(40,40,40)->generate('Make me a QrCode!');
|
||||
|
||||
你还能不存储图片,而使用 `base64_encode` 来将二进制数据直接显示成二维码图片.
|
||||
|
||||
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Make me into an QrCode!')) !!} ">
|
||||
|
||||
<a id="docs-helpers"></a>
|
||||
## 助手模板
|
||||
|
||||
#### 什么是助手模板?
|
||||
|
||||
助手模板生成一些简易二维码, 扫描二维码时会进行某些操作.
|
||||
|
||||
#### BitCoin比特币
|
||||
|
||||
这个模板生成可扫描二维码的来接受比特币支付. [详情](https://bitco.in/en/developer-guide#plain-text)
|
||||
|
||||
QrCode::BTC($address, $amount);
|
||||
|
||||
//发送0.334BTC到该地址
|
||||
QrCode::BTC('bitcoin address', 0.334);
|
||||
|
||||
//发送0.334BTC到该地址和一些可选设置
|
||||
QrCode::size(500)->BTC('address', 0.0034, [
|
||||
'label' => 'my label',
|
||||
'message' => 'my message',
|
||||
'returnAddress' => 'https://www.returnaddress.com'
|
||||
]);
|
||||
|
||||
#### E-Mail
|
||||
|
||||
这个模板可以生成一个直接发E-mail的二维码.包含了发邮件的地址,标题,和内容
|
||||
|
||||
QrCode::email($to, $subject, $body);
|
||||
|
||||
//加入一个邮件地址
|
||||
QrCode::email('foo@bar.com');
|
||||
|
||||
//加一个邮件地址、标题、内容至二维码.
|
||||
QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');
|
||||
|
||||
//只加标题和内容.
|
||||
QrCode::email(null, 'This is the subject.', 'This is the message body.');
|
||||
|
||||
#### 位置
|
||||
|
||||
这个模板能创建一个包含一个经纬度的位置二维码, 并在谷歌地图或类似应用中打开.
|
||||
|
||||
QrCode::geo($latitude, $longitude);
|
||||
|
||||
QrCode::geo(37.822214, -122.481769);
|
||||
|
||||
#### 手机号
|
||||
|
||||
这个模板能创建一个包含手机号的二维码, 并拨号.
|
||||
|
||||
QrCode::phoneNumber($phoneNumber);
|
||||
|
||||
QrCode::phoneNumber('555-555-5555');
|
||||
QrCode::phoneNumber('1-800-Laravel');
|
||||
|
||||
#### 短信
|
||||
|
||||
这个模板能创建能创建一个包含发送短信目标手机号和内容的二维码.
|
||||
|
||||
QrCode::SMS($phoneNumber, $message);
|
||||
|
||||
//创建一个只有手机号的短信二维码.
|
||||
QrCode::SMS('555-555-5555');
|
||||
|
||||
//创建一个包含手机号和文字内容的短信二维码.
|
||||
QrCode::SMS('555-555-5555', 'Body of the message');
|
||||
|
||||
#### WiFi
|
||||
|
||||
这个模板能创建扫一下能连接WIFI的二维码.
|
||||
|
||||
QrCode::wiFi([
|
||||
'encryption' => 'WPA/WEP',
|
||||
'ssid' => '网络的SSID',
|
||||
'password' => '网络的密码',
|
||||
'hidden' => '是否是一个隐藏SSID的网络'
|
||||
]);
|
||||
|
||||
//连接一个开放的网络
|
||||
QrCode::wiFi([
|
||||
'ssid' => '网络名称',
|
||||
]);
|
||||
|
||||
//连接一个开放并隐藏的网络.
|
||||
QrCode::wiFi([
|
||||
'ssid' => '网络名称',
|
||||
'hidden' => 'true'
|
||||
]);
|
||||
|
||||
//连接一个加密的WIFI网络.
|
||||
QrCode::wiFi([
|
||||
'ssid' => '网络名称',
|
||||
'encryption' => 'WPA',
|
||||
'password' => '密码'
|
||||
]);
|
||||
|
||||
> WIFI扫描目前苹果产品不支持.
|
||||
|
||||
<a id="docs-common-usage"></a>
|
||||
##QrCode 常规用法
|
||||
|
||||
你还能通过下面表中的前缀信息创建适合更多场合的二维码
|
||||
|
||||
QrCode::generate('http://www.simplesoftware.io');
|
||||
|
||||
|
||||
| 使用场景 | 前缀 | 例子 |
|
||||
| --- | --- | --- |
|
||||
| 网址 | http:// | http://www.simplesoftware.io |
|
||||
| 加密网址 | https:// | https://www.simplesoftware.io |
|
||||
| E-mail 地址 | mailto: | mailto:support@simplesoftware.io |
|
||||
| 电话号码 | tel: | tel:555-555-5555 |
|
||||
| 文字短信 | sms: | sms:555-555-5555 |
|
||||
| 文字短信内容 | sms: | sms::I am a pretyped message |
|
||||
| 文字短信同时附带手机号和短信内容 | sms: | sms:555-555-5555:I am a pretyped message |
|
||||
| 坐标 | geo: | geo:-78.400364,-85.916993 |
|
||||
| MeCard名片 | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
|
||||
| VCard名片 | BEGIN:VCARD | [更多范例](https://en.wikipedia.org/wiki/VCard) |
|
||||
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
|
||||
|
||||
<a id="docs-outside-laravel"></a>
|
||||
##在Laravel外的调用方式
|
||||
|
||||
你还可以在Laravel框架之外调用,只需要实例化 `BaconQrCodeGenerator` 类.
|
||||
|
||||
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
|
||||
|
||||
$qrcode = new BaconQrCodeGenerator;
|
||||
$qrcode->size(500)->generate('Make a qrcode without Laravel!');
|
||||
17
vendor/simplesoftwareio/simple-qrcode/phpunit.xml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="./vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
127
vendor/simplesoftwareio/simple-qrcode/src/DataTypes/BTC.php
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode\DataTypes;
|
||||
|
||||
class BTC implements DataTypeInterface
|
||||
{
|
||||
/**
|
||||
* The prefix of the QrCode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $prefix = 'bitcoin:';
|
||||
|
||||
/**
|
||||
* The BitCoin address.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
/**
|
||||
* The amount to send.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $amount;
|
||||
|
||||
/**
|
||||
* The BitCoin transaction label.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $label;
|
||||
|
||||
/**
|
||||
* The BitCoin message to send.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $message;
|
||||
|
||||
/**
|
||||
* The BitCoin return URL.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $returnAddress;
|
||||
|
||||
/**
|
||||
* Generates the DataType Object and sets all of its properties.
|
||||
*
|
||||
* @param $arguments
|
||||
*/
|
||||
public function create(array $arguments)
|
||||
{
|
||||
$this->setProperties($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the correct QrCode format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->buildBitCoinString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the BitCoin arguments.
|
||||
*
|
||||
* @param array $arguments
|
||||
*/
|
||||
protected function setProperties(array $arguments)
|
||||
{
|
||||
if (isset($arguments[0])) {
|
||||
$this->address = $arguments[0];
|
||||
}
|
||||
|
||||
if (isset($arguments[1])) {
|
||||
$this->amount = $arguments[1];
|
||||
}
|
||||
|
||||
if (isset($arguments[2])) {
|
||||
$this->setOptions($arguments[2]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the optional BitCoin options.
|
||||
*
|
||||
* @param array $options
|
||||
*/
|
||||
protected function setOptions(array $options)
|
||||
{
|
||||
if (isset($options['label'])) {
|
||||
$this->label = $options['label'];
|
||||
}
|
||||
|
||||
if (isset($options['message'])) {
|
||||
$this->message = $options['message'];
|
||||
}
|
||||
|
||||
if (isset($options['returnAddress'])) {
|
||||
$this->returnAddress = $options['returnAddress'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a BitCoin string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildBitCoinString()
|
||||
{
|
||||
$query = http_build_query([
|
||||
'amount' => $this->amount,
|
||||
'label' => $this->label,
|
||||
'message' => $this->message,
|
||||
'r' => $this->returnAddress,
|
||||
]);
|
||||
|
||||
$btc = $this->prefix.$this->address.'?'.$query;
|
||||
|
||||
return $btc;
|
||||
}
|
||||
}
|
||||
18
vendor/simplesoftwareio/simple-qrcode/src/DataTypes/DataTypeInterface.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode\DataTypes;
|
||||
|
||||
interface DataTypeInterface
|
||||
{
|
||||
/**
|
||||
* Generates the DataType Object and sets all of its properties.
|
||||
*/
|
||||
public function create(array $arguments);
|
||||
|
||||
/**
|
||||
* Returns the correct QrCode format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
}
|
||||
122
vendor/simplesoftwareio/simple-qrcode/src/DataTypes/Email.php
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode\DataTypes;
|
||||
|
||||
use BaconQrCode\Exception\InvalidArgumentException;
|
||||
|
||||
class Email implements DataTypeInterface
|
||||
{
|
||||
/**
|
||||
* The prefix of the QrCode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $prefix = 'mailto:';
|
||||
|
||||
/**
|
||||
* The email address.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $email;
|
||||
|
||||
/**
|
||||
* The subject of the email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $subject;
|
||||
|
||||
/**
|
||||
* The body of an email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $body;
|
||||
|
||||
/**
|
||||
* Generates the DataType Object and sets all of its properties.
|
||||
*
|
||||
* @param $arguments
|
||||
*/
|
||||
public function create(array $arguments)
|
||||
{
|
||||
$this->setProperties($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the correct QrCode format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->buildEmailString();
|
||||
}
|
||||
|
||||
/*
|
||||
* Builds the email string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildEmailString()
|
||||
{
|
||||
$email = $this->prefix.$this->email;
|
||||
|
||||
if (isset($this->subject) || isset($this->body)) {
|
||||
$data = [
|
||||
'subject' => $this->subject,
|
||||
'body' => $this->body,
|
||||
];
|
||||
$email .= '?'.http_build_query($data);
|
||||
}
|
||||
|
||||
return $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the objects properties.
|
||||
*
|
||||
* @param $arguments
|
||||
*/
|
||||
protected function setProperties(array $arguments)
|
||||
{
|
||||
if (isset($arguments[0])) {
|
||||
$this->setEmail($arguments[0]);
|
||||
}
|
||||
if (isset($arguments[1])) {
|
||||
$this->subject = $arguments[1];
|
||||
}
|
||||
if (isset($arguments[2])) {
|
||||
$this->body = $arguments[2];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the email property.
|
||||
*
|
||||
* @param $email
|
||||
*/
|
||||
protected function setEmail($email)
|
||||
{
|
||||
if ($this->isValidEmail($email)) {
|
||||
$this->email = $email;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures an email is valid.
|
||||
*
|
||||
* @param string $email
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isValidEmail($email)
|
||||
{
|
||||
if (! filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
throw new InvalidArgumentException('Invalid email provided');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
55
vendor/simplesoftwareio/simple-qrcode/src/DataTypes/Geo.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode\DataTypes;
|
||||
|
||||
class Geo implements DataTypeInterface
|
||||
{
|
||||
/**
|
||||
* The prefix of the QrCode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $prefix = 'geo:';
|
||||
|
||||
/**
|
||||
* The separator between the variables.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $separator = ',';
|
||||
|
||||
/**
|
||||
* The latitude.
|
||||
*
|
||||
* @var
|
||||
*/
|
||||
protected $latitude;
|
||||
|
||||
/**
|
||||
* The longitude.
|
||||
*
|
||||
* @var
|
||||
*/
|
||||
protected $longitude;
|
||||
|
||||
/**
|
||||
* Generates the DataType Object and sets all of its properties.
|
||||
*
|
||||
* @param $arguments
|
||||
*/
|
||||
public function create(array $arguments)
|
||||
{
|
||||
$this->latitude = $arguments[0];
|
||||
$this->longitude = $arguments[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the correct QrCode format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->prefix.$this->latitude.$this->separator.$this->longitude;
|
||||
}
|
||||
}
|
||||
40
vendor/simplesoftwareio/simple-qrcode/src/DataTypes/PhoneNumber.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode\DataTypes;
|
||||
|
||||
class PhoneNumber implements DataTypeInterface
|
||||
{
|
||||
/**
|
||||
* The prefix of the QrCode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $prefix = 'tel:';
|
||||
|
||||
/**
|
||||
* The phone number.
|
||||
*
|
||||
* @var
|
||||
*/
|
||||
protected $phoneNumber;
|
||||
|
||||
/**
|
||||
* Generates the DataType Object and sets all of its properties.
|
||||
*
|
||||
* @param $arguments
|
||||
*/
|
||||
public function create(array $arguments)
|
||||
{
|
||||
$this->phoneNumber = $arguments[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the correct QrCode format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->prefix.$this->phoneNumber;
|
||||
}
|
||||
}
|
||||
85
vendor/simplesoftwareio/simple-qrcode/src/DataTypes/SMS.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode\DataTypes;
|
||||
|
||||
class SMS implements DataTypeInterface
|
||||
{
|
||||
/**
|
||||
* The prefix of the QrCode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $prefix = 'sms:';
|
||||
|
||||
/**
|
||||
* The separator between the variables.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $separator = '&body=';
|
||||
|
||||
/**
|
||||
* The phone number.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $phoneNumber;
|
||||
|
||||
/**
|
||||
* The SMS message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $message;
|
||||
|
||||
/**
|
||||
* Generates the DataType Object and sets all of its properties.
|
||||
*
|
||||
* @param $arguments
|
||||
*/
|
||||
public function create(array $arguments)
|
||||
{
|
||||
$this->setProperties($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the correct QrCode format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->buildSMSString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the phone number and message for a sms message.
|
||||
*
|
||||
* @param array $arguments
|
||||
*/
|
||||
protected function setProperties(array $arguments)
|
||||
{
|
||||
if (isset($arguments[0])) {
|
||||
$this->phoneNumber = $arguments[0];
|
||||
}
|
||||
if (isset($arguments[1])) {
|
||||
$this->message = $arguments[1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a SMS string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildSMSString()
|
||||
{
|
||||
$sms = $this->prefix.$this->phoneNumber;
|
||||
|
||||
if (isset($this->message)) {
|
||||
$sms .= $this->separator.$this->message;
|
||||
}
|
||||
|
||||
return $sms;
|
||||
}
|
||||
}
|
||||
115
vendor/simplesoftwareio/simple-qrcode/src/DataTypes/WiFi.php
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode\DataTypes;
|
||||
|
||||
class WiFi implements DataTypeInterface
|
||||
{
|
||||
/**
|
||||
* The prefix of the QrCode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $prefix = 'WIFI:';
|
||||
|
||||
/**
|
||||
* The separator between the variables.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $separator = ';';
|
||||
|
||||
/**
|
||||
* The encryption of the network. WEP or WPA.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $encryption;
|
||||
|
||||
/**
|
||||
* The SSID of the WiFi network.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $ssid;
|
||||
|
||||
/**
|
||||
* The password of the network.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
* Whether the network is a hidden SSID or not.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $hidden;
|
||||
|
||||
/**
|
||||
* Generates the DataType Object and sets all of its properties.
|
||||
*
|
||||
* @param $arguments
|
||||
*/
|
||||
public function create(array $arguments)
|
||||
{
|
||||
$this->setProperties($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the correct QrCode format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->buildWifiString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the WiFi string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildWifiString()
|
||||
{
|
||||
$wifi = $this->prefix;
|
||||
|
||||
if (isset($this->encryption)) {
|
||||
$wifi .= 'T:'.$this->encryption.$this->separator;
|
||||
}
|
||||
if (isset($this->ssid)) {
|
||||
$wifi .= 'S:'.$this->ssid.$this->separator;
|
||||
}
|
||||
if (isset($this->password)) {
|
||||
$wifi .= 'P:'.$this->password.$this->separator;
|
||||
}
|
||||
if (isset($this->hidden)) {
|
||||
$wifi .= 'H:'.$this->hidden.$this->separator;
|
||||
}
|
||||
|
||||
return $wifi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the WiFi properties.
|
||||
*
|
||||
* @param $arguments
|
||||
*/
|
||||
protected function setProperties(array $arguments)
|
||||
{
|
||||
$arguments = $arguments[0];
|
||||
if (isset($arguments['encryption'])) {
|
||||
$this->encryption = $arguments['encryption'];
|
||||
}
|
||||
if (isset($arguments['ssid'])) {
|
||||
$this->ssid = $arguments['ssid'];
|
||||
}
|
||||
if (isset($arguments['password'])) {
|
||||
$this->password = $arguments['password'];
|
||||
}
|
||||
if (isset($arguments['hidden'])) {
|
||||
$this->hidden = $arguments['hidden'];
|
||||
}
|
||||
}
|
||||
}
|
||||
21
vendor/simplesoftwareio/simple-qrcode/src/Facades/QrCode.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use SimpleSoftwareIO\QrCode\Generator;
|
||||
|
||||
class QrCode extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
self::clearResolvedInstance(Generator::class);
|
||||
|
||||
return Generator::class;
|
||||
}
|
||||
}
|
||||
578
vendor/simplesoftwareio/simple-qrcode/src/Generator.php
vendored
Normal file
@@ -0,0 +1,578 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode;
|
||||
|
||||
use BaconQrCode\Common\ErrorCorrectionLevel;
|
||||
use BaconQrCode\Encoder\Encoder;
|
||||
use BaconQrCode\Exception\WriterException;
|
||||
use BaconQrCode\Renderer\Color\Alpha;
|
||||
use BaconQrCode\Renderer\Color\ColorInterface;
|
||||
use BaconQrCode\Renderer\Color\Rgb;
|
||||
use BaconQrCode\Renderer\Eye\EyeInterface;
|
||||
use BaconQrCode\Renderer\Eye\ModuleEye;
|
||||
use BaconQrCode\Renderer\Eye\SimpleCircleEye;
|
||||
use BaconQrCode\Renderer\Eye\SquareEye;
|
||||
use BaconQrCode\Renderer\Image\EpsImageBackEnd;
|
||||
use BaconQrCode\Renderer\Image\ImageBackEndInterface;
|
||||
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
|
||||
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
|
||||
use BaconQrCode\Renderer\ImageRenderer;
|
||||
use BaconQrCode\Renderer\Module\DotsModule;
|
||||
use BaconQrCode\Renderer\Module\ModuleInterface;
|
||||
use BaconQrCode\Renderer\Module\RoundnessModule;
|
||||
use BaconQrCode\Renderer\Module\SquareModule;
|
||||
use BaconQrCode\Renderer\RendererStyle\EyeFill;
|
||||
use BaconQrCode\Renderer\RendererStyle\Fill;
|
||||
use BaconQrCode\Renderer\RendererStyle\Gradient;
|
||||
use BaconQrCode\Renderer\RendererStyle\GradientType;
|
||||
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
|
||||
use BaconQrCode\Writer;
|
||||
use BadMethodCallException;
|
||||
use InvalidArgumentException;
|
||||
use SimpleSoftwareIO\QrCode\DataTypes\DataTypeInterface;
|
||||
|
||||
class Generator
|
||||
{
|
||||
/**
|
||||
* Holds the selected formatter.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $format = 'svg';
|
||||
|
||||
/**
|
||||
* Holds the size of the QrCode in pixels.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $pixels = 100;
|
||||
|
||||
/**
|
||||
* Holds the margin size of the QrCode.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $margin = 0;
|
||||
|
||||
/**
|
||||
* Holds the selected error correction.
|
||||
* L: 7% loss.
|
||||
* M: 15% loss.
|
||||
* Q: 25% loss.
|
||||
* H: 30% loss.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $errorCorrection = null;
|
||||
|
||||
/**
|
||||
* Holds the selected encoder. Possible values are
|
||||
* ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6,
|
||||
* ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10, ISO-8859-11,
|
||||
* ISO-8859-12, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16,
|
||||
* SHIFT-JIS, WINDOWS-1250, WINDOWS-1251, WINDOWS-1252, WINDOWS-1256,
|
||||
* UTF-16BE, UTF-8, ASCII, GBK, EUC-KR.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING;
|
||||
|
||||
/**
|
||||
* The style of the blocks within the QrCode.
|
||||
* Possible values are square, dot, and round.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $style = 'square';
|
||||
|
||||
/**
|
||||
* The size of the selected style between 0 and 1.
|
||||
* This only applies to dot and round.
|
||||
*
|
||||
* @var float|null
|
||||
*/
|
||||
protected $styleSize = null;
|
||||
|
||||
/**
|
||||
* The style to apply to the eye.
|
||||
* Possible values are circle and square.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $eyeStyle = null;
|
||||
|
||||
/**
|
||||
* The foreground color of the QrCode.
|
||||
*
|
||||
* @var ColorInterface|null
|
||||
*/
|
||||
protected $color = null;
|
||||
|
||||
/**
|
||||
* The background color of the QrCode.
|
||||
*
|
||||
* @var ColorInterface|null
|
||||
*/
|
||||
protected $backgroundColor = null;
|
||||
|
||||
/**
|
||||
* An array that holds EyeFills of the color of the eyes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $eyeColors = [];
|
||||
|
||||
/**
|
||||
* The gradient to apply to the QrCode.
|
||||
*
|
||||
* @var Gradient
|
||||
*/
|
||||
protected $gradient;
|
||||
|
||||
/**
|
||||
* Holds an image string that will be merged with the QrCode.
|
||||
*
|
||||
* @var null|string
|
||||
*/
|
||||
protected $imageMerge = null;
|
||||
|
||||
/**
|
||||
* The percentage that a merged image should take over the source image.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
protected $imagePercentage = .2;
|
||||
|
||||
/**
|
||||
* Creates a new datatype object and then generates a QrCode.
|
||||
*
|
||||
* @param $method
|
||||
* @param array $arguments
|
||||
*/
|
||||
public function __call($method, array $arguments)
|
||||
{
|
||||
$dataType = $this->createClass($method);
|
||||
$dataType->create($arguments);
|
||||
|
||||
return $this->generate(strval($dataType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the QrCode.
|
||||
*
|
||||
* @param string $text
|
||||
* @param string|null $filename
|
||||
* @return void|Illuminate\Support\HtmlString|string
|
||||
* @throws WriterException
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function generate(string $text, string $filename = null)
|
||||
{
|
||||
$qrCode = $this->getWriter($this->getRenderer())->writeString($text, $this->encoding, $this->errorCorrection);
|
||||
|
||||
if ($this->imageMerge !== null && $this->format === 'png') {
|
||||
$merger = new ImageMerge(new Image($qrCode), new Image($this->imageMerge));
|
||||
$qrCode = $merger->merge($this->imagePercentage);
|
||||
}
|
||||
|
||||
if ($filename) {
|
||||
file_put_contents($filename, $qrCode);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (class_exists(\Illuminate\Support\HtmlString::class)) {
|
||||
return new \Illuminate\Support\HtmlString($qrCode);
|
||||
}
|
||||
|
||||
return $qrCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges an image over the QrCode.
|
||||
*
|
||||
* @param string $filepath
|
||||
* @param float $percentage
|
||||
* @param SimpleSoftwareIO\QrCode\boolean|bool $absolute
|
||||
* @return Generator
|
||||
*/
|
||||
public function merge(string $filepath, float $percentage = .2, bool $absolute = false): self
|
||||
{
|
||||
if (function_exists('base_path') && ! $absolute) {
|
||||
$filepath = base_path().$filepath;
|
||||
}
|
||||
|
||||
$this->imageMerge = file_get_contents($filepath);
|
||||
$this->imagePercentage = $percentage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges an image string with the center of the QrCode.
|
||||
*
|
||||
* @param string $content
|
||||
* @param float $percentage
|
||||
* @return Generator
|
||||
*/
|
||||
public function mergeString(string $content, float $percentage = .2): self
|
||||
{
|
||||
$this->imageMerge = $content;
|
||||
$this->imagePercentage = $percentage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the size of the QrCode.
|
||||
*
|
||||
* @param int $pixels
|
||||
* @return Generator
|
||||
*/
|
||||
public function size(int $pixels): self
|
||||
{
|
||||
$this->pixels = $pixels;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the format of the QrCode.
|
||||
*
|
||||
* @param string $format
|
||||
* @return Generator
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function format(string $format): self
|
||||
{
|
||||
if (! in_array($format, ['svg', 'eps', 'png'])) {
|
||||
throw new InvalidArgumentException("\$format must be svg, eps, or png. {$format} is not a valid.");
|
||||
}
|
||||
|
||||
$this->format = $format;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the foreground color of the QrCode.
|
||||
*
|
||||
* @param int $red
|
||||
* @param int $green
|
||||
* @param int $blue
|
||||
* @param null|int $alpha
|
||||
* @return Generator
|
||||
*/
|
||||
public function color(int $red, int $green, int $blue, ?int $alpha = null): self
|
||||
{
|
||||
$this->color = $this->createColor($red, $green, $blue, $alpha);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the background color of the QrCode.
|
||||
*
|
||||
* @param int $red
|
||||
* @param int $green
|
||||
* @param int $blue
|
||||
* @param null|int $alpha
|
||||
* @return Generator
|
||||
*/
|
||||
public function backgroundColor(int $red, int $green, int $blue, ?int $alpha = null): self
|
||||
{
|
||||
$this->backgroundColor = $this->createColor($red, $green, $blue, $alpha);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the eye color for the provided eye index.
|
||||
*
|
||||
* @param int $eyeNumber
|
||||
* @param int $innerRed
|
||||
* @param int $innerGreen
|
||||
* @param int $innerBlue
|
||||
* @param int $outterRed
|
||||
* @param int $outterGreen
|
||||
* @param int $outterBlue
|
||||
* @return Generator
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function eyeColor(int $eyeNumber, int $innerRed, int $innerGreen, int $innerBlue, int $outterRed = 0, int $outterGreen = 0, int $outterBlue = 0): self
|
||||
{
|
||||
if ($eyeNumber < 0 || $eyeNumber > 2) {
|
||||
throw new InvalidArgumentException("\$eyeNumber must be 0, 1, or 2. {$eyeNumber} is not valid.");
|
||||
}
|
||||
|
||||
$this->eyeColors[$eyeNumber] = new EyeFill(
|
||||
$this->createColor($innerRed, $innerGreen, $innerBlue),
|
||||
$this->createColor($outterRed, $outterGreen, $outterBlue)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function gradient($startRed, $startGreen, $startBlue, $endRed, $endGreen, $endBlue, string $type): self
|
||||
{
|
||||
$type = strtoupper($type);
|
||||
$this->gradient = new Gradient(
|
||||
$this->createColor($startRed, $startGreen, $startBlue),
|
||||
$this->createColor($endRed, $endGreen, $endBlue),
|
||||
GradientType::$type()
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the eye style.
|
||||
*
|
||||
* @param string $style
|
||||
* @return Generator
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function eye(string $style): self
|
||||
{
|
||||
if (! in_array($style, ['square', 'circle'])) {
|
||||
throw new InvalidArgumentException("\$style must be square or circle. {$style} is not a valid eye style.");
|
||||
}
|
||||
|
||||
$this->eyeStyle = $style;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the style of the blocks for the QrCode.
|
||||
*
|
||||
* @param string $style
|
||||
* @param float $size
|
||||
* @return Generator
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function style(string $style, float $size = 0.5): self
|
||||
{
|
||||
if (! in_array($style, ['square', 'dot', 'round'])) {
|
||||
throw new InvalidArgumentException("\$style must be square, dot, or round. {$style} is not a valid.");
|
||||
}
|
||||
|
||||
if ($size < 0 || $size >= 1) {
|
||||
throw new InvalidArgumentException("\$size must be between 0 and 1. {$size} is not valid.");
|
||||
}
|
||||
|
||||
$this->style = $style;
|
||||
$this->styleSize = $size;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the encoding for the QrCode.
|
||||
* Possible values are
|
||||
* ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6,
|
||||
* ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10, ISO-8859-11,
|
||||
* ISO-8859-12, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16,
|
||||
* SHIFT-JIS, WINDOWS-1250, WINDOWS-1251, WINDOWS-1252, WINDOWS-1256,
|
||||
* UTF-16BE, UTF-8, ASCII, GBK, EUC-KR.
|
||||
*
|
||||
* @param string $encoding
|
||||
* @return Generator
|
||||
*/
|
||||
public function encoding(string $encoding): self
|
||||
{
|
||||
$this->encoding = strtoupper($encoding);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the error correction for the QrCode.
|
||||
* L: 7% loss.
|
||||
* M: 15% loss.
|
||||
* Q: 25% loss.
|
||||
* H: 30% loss.
|
||||
*
|
||||
* @param string $errorCorrection
|
||||
* @return Generator
|
||||
*/
|
||||
public function errorCorrection(string $errorCorrection): self
|
||||
{
|
||||
$errorCorrection = strtoupper($errorCorrection);
|
||||
$this->errorCorrection = ErrorCorrectionLevel::$errorCorrection();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the margin of the QrCode.
|
||||
*
|
||||
* @param int $margin
|
||||
* @return Generator
|
||||
*/
|
||||
public function margin(int $margin): self
|
||||
{
|
||||
$this->margin = $margin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the Writer.
|
||||
*
|
||||
* @param ImageRenderer $renderer
|
||||
* @return Writer
|
||||
*/
|
||||
public function getWriter(ImageRenderer $renderer): Writer
|
||||
{
|
||||
return new Writer($renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the Image Renderer.
|
||||
*
|
||||
* @return ImageRenderer
|
||||
*/
|
||||
public function getRenderer(): ImageRenderer
|
||||
{
|
||||
$renderer = new ImageRenderer(
|
||||
$this->getRendererStyle(),
|
||||
$this->getFormatter()
|
||||
);
|
||||
|
||||
return $renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Renderer Style.
|
||||
*
|
||||
* @return RendererStyle
|
||||
*/
|
||||
public function getRendererStyle(): RendererStyle
|
||||
{
|
||||
return new RendererStyle($this->pixels, $this->margin, $this->getModule(), $this->getEye(), $this->getFill());
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the formatter.
|
||||
*
|
||||
* @return ImageBackEndInterface
|
||||
*/
|
||||
public function getFormatter(): ImageBackEndInterface
|
||||
{
|
||||
if ($this->format === 'png') {
|
||||
return new ImagickImageBackEnd('png');
|
||||
}
|
||||
|
||||
if ($this->format === 'eps') {
|
||||
return new EpsImageBackEnd;
|
||||
}
|
||||
|
||||
return new SvgImageBackEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the module.
|
||||
*
|
||||
* @return ModuleInterface
|
||||
*/
|
||||
public function getModule(): ModuleInterface
|
||||
{
|
||||
if ($this->style === 'dot') {
|
||||
return new DotsModule($this->styleSize);
|
||||
}
|
||||
|
||||
if ($this->style === 'round') {
|
||||
return new RoundnessModule($this->styleSize);
|
||||
}
|
||||
|
||||
return SquareModule::instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the eye style.
|
||||
*
|
||||
* @return EyeInterface
|
||||
*/
|
||||
public function getEye(): EyeInterface
|
||||
{
|
||||
if ($this->eyeStyle === 'square') {
|
||||
return SquareEye::instance();
|
||||
}
|
||||
|
||||
if ($this->eyeStyle === 'circle') {
|
||||
return SimpleCircleEye::instance();
|
||||
}
|
||||
|
||||
return new ModuleEye($this->getModule());
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the color fill.
|
||||
*
|
||||
* @return Fill
|
||||
*/
|
||||
public function getFill(): Fill
|
||||
{
|
||||
$foregroundColor = $this->color ?? new Rgb(0, 0, 0);
|
||||
$backgroundColor = $this->backgroundColor ?? new Rgb(255, 255, 255);
|
||||
$eye0 = $this->eyeColors[0] ?? EyeFill::inherit();
|
||||
$eye1 = $this->eyeColors[1] ?? EyeFill::inherit();
|
||||
$eye2 = $this->eyeColors[2] ?? EyeFill::inherit();
|
||||
|
||||
if ($this->gradient) {
|
||||
return Fill::withForegroundGradient($backgroundColor, $this->gradient, $eye0, $eye1, $eye2);
|
||||
}
|
||||
|
||||
return Fill::withForegroundColor($backgroundColor, $foregroundColor, $eye0, $eye1, $eye2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a RGB or Alpha channel color.
|
||||
* @param int $red
|
||||
* @param int $green
|
||||
* @param int $blue
|
||||
* @param null|int $alpha
|
||||
* @return ColorInterface
|
||||
*/
|
||||
public function createColor(int $red, int $green, int $blue, ?int $alpha = null): ColorInterface
|
||||
{
|
||||
if (is_null($alpha)) {
|
||||
return new Rgb($red, $green, $blue);
|
||||
}
|
||||
|
||||
return new Alpha($alpha, new Rgb($red, $green, $blue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DataType class dynamically.
|
||||
*
|
||||
* @param string $method
|
||||
* @return DataTypeInterface
|
||||
*/
|
||||
protected function createClass(string $method): DataTypeInterface
|
||||
{
|
||||
$class = $this->formatClass($method);
|
||||
|
||||
if (! class_exists($class)) {
|
||||
throw new BadMethodCallException();
|
||||
}
|
||||
|
||||
return new $class();
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the method name correctly.
|
||||
*
|
||||
* @param $method
|
||||
* @return string
|
||||
*/
|
||||
protected function formatClass(string $method): string
|
||||
{
|
||||
$method = ucfirst($method);
|
||||
|
||||
$class = "SimpleSoftwareIO\QrCode\DataTypes\\".$method;
|
||||
|
||||
return $class;
|
||||
}
|
||||
}
|
||||
63
vendor/simplesoftwareio/simple-qrcode/src/Image.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode;
|
||||
|
||||
class Image
|
||||
{
|
||||
/**
|
||||
* Holds the image resource.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
protected $image;
|
||||
|
||||
/**
|
||||
* Creates a new Image object.
|
||||
*
|
||||
* @param $image string An image string
|
||||
*/
|
||||
public function __construct($image)
|
||||
{
|
||||
$this->image = imagecreatefromstring($image);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the width of an image
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return imagesx($this->image);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the height of an image
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return imagesy($this->image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the image string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getImageResource()
|
||||
{
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the image string.
|
||||
*
|
||||
* @param resource $image
|
||||
*/
|
||||
public function setImageResource($image)
|
||||
{
|
||||
$this->image = $image;
|
||||
}
|
||||
}
|
||||
204
vendor/simplesoftwareio/simple-qrcode/src/ImageMerge.php
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
class ImageMerge
|
||||
{
|
||||
/**
|
||||
* Holds the QrCode image.
|
||||
*
|
||||
* @var Image
|
||||
*/
|
||||
protected $sourceImage;
|
||||
|
||||
/**
|
||||
* Holds the merging image.
|
||||
*
|
||||
* @var Image
|
||||
*/
|
||||
protected $mergeImage;
|
||||
|
||||
/**
|
||||
* The height of the source image.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $sourceImageHeight;
|
||||
|
||||
/**
|
||||
* The width of the source image.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $sourceImageWidth;
|
||||
|
||||
/**
|
||||
* The height of the merge image.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $mergeImageHeight;
|
||||
|
||||
/**
|
||||
* The width of the merge image.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $mergeImageWidth;
|
||||
|
||||
/**
|
||||
* Holds the radio of the merging image.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
protected $mergeRatio;
|
||||
|
||||
/**
|
||||
* The height of the merge image after it is merged.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $postMergeImageHeight;
|
||||
|
||||
/**
|
||||
* The width of the merge image after it is merged.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $postMergeImageWidth;
|
||||
|
||||
/**
|
||||
* The position that the merge image is placed on top of the source image.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $centerY;
|
||||
|
||||
/**
|
||||
* The position that the merge image is placed on top of the source image.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $centerX;
|
||||
|
||||
/**
|
||||
* Creates a new ImageMerge object.
|
||||
*
|
||||
* @param $sourceImage Image The image that will be merged over.
|
||||
* @param $mergeImage Image The image that will be used to merge with $sourceImage
|
||||
*/
|
||||
public function __construct(Image $sourceImage, Image $mergeImage)
|
||||
{
|
||||
$this->sourceImage = $sourceImage;
|
||||
$this->mergeImage = $mergeImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an QrCode that has been merge with another image.
|
||||
* This is usually used with logos to imprint a logo into a QrCode.
|
||||
*
|
||||
* @param $percentage float The percentage of size relative to the entire QR of the merged image
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function merge($percentage)
|
||||
{
|
||||
$this->setProperties($percentage);
|
||||
|
||||
$img = imagecreatetruecolor($this->sourceImage->getWidth(), $this->sourceImage->getHeight());
|
||||
imagealphablending($img, true);
|
||||
$transparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
|
||||
imagefill($img, 0, 0, $transparent);
|
||||
|
||||
imagecopy(
|
||||
$img,
|
||||
$this->sourceImage->getImageResource(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
$this->sourceImage->getWidth(),
|
||||
$this->sourceImage->getHeight()
|
||||
);
|
||||
|
||||
imagecopyresampled(
|
||||
$img,
|
||||
$this->mergeImage->getImageResource(),
|
||||
$this->centerX,
|
||||
$this->centerY,
|
||||
0,
|
||||
0,
|
||||
$this->postMergeImageWidth,
|
||||
$this->postMergeImageHeight,
|
||||
$this->mergeImageWidth,
|
||||
$this->mergeImageHeight
|
||||
);
|
||||
|
||||
$this->sourceImage->setImageResource($img);
|
||||
|
||||
return $this->createImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a PNG Image.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function createImage()
|
||||
{
|
||||
ob_start();
|
||||
imagepng($this->sourceImage->getImageResource());
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the objects properties.
|
||||
*
|
||||
* @param $percentage float The percentage that the merge image should take up.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setProperties($percentage)
|
||||
{
|
||||
if ($percentage > 1) {
|
||||
throw new InvalidArgumentException('$percentage must be less than 1');
|
||||
}
|
||||
|
||||
$this->sourceImageHeight = $this->sourceImage->getHeight();
|
||||
$this->sourceImageWidth = $this->sourceImage->getWidth();
|
||||
|
||||
$this->mergeImageHeight = $this->mergeImage->getHeight();
|
||||
$this->mergeImageWidth = $this->mergeImage->getWidth();
|
||||
|
||||
$this->calculateOverlap($percentage);
|
||||
$this->calculateCenter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the center of the source Image using the Merge image.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function calculateCenter()
|
||||
{
|
||||
$this->centerX = intval(($this->sourceImageWidth / 2) - ($this->postMergeImageWidth / 2));
|
||||
$this->centerY = intval(($this->sourceImageHeight / 2) - ($this->postMergeImageHeight / 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the width of the merge image being placed on the source image.
|
||||
*
|
||||
* @param float $percentage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function calculateOverlap($percentage)
|
||||
{
|
||||
$this->mergeRatio = round($this->mergeImageWidth / $this->mergeImageHeight, 2);
|
||||
$this->postMergeImageWidth = intval($this->sourceImageWidth * $percentage);
|
||||
$this->postMergeImageHeight = intval($this->postMergeImageWidth / $this->mergeRatio);
|
||||
}
|
||||
}
|
||||
28
vendor/simplesoftwareio/simple-qrcode/src/QrCodeServiceProvider.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleSoftwareIO\QrCode;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class QrCodeServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind('qrcode', function () {
|
||||
return new Generator();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [Generator::class];
|
||||
}
|
||||
}
|
||||
47
vendor/simplesoftwareio/simple-qrcode/tests/DataTypes/BTCTest.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\DataTypes\BTC;
|
||||
|
||||
class BTCTest extends TestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->btc = new BTC();
|
||||
}
|
||||
|
||||
public function test_it_generates_a_valid_btc_qrcode_with_an_address_and_amount()
|
||||
{
|
||||
$this->btc->create(['btcaddress', 0.0034]);
|
||||
|
||||
$properFormat = 'bitcoin:btcaddress?amount=0.0034';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->btc));
|
||||
}
|
||||
|
||||
public function test_it_generates_a_valid_btc_qrcode_with_an_address_amount_and_label()
|
||||
{
|
||||
$this->btc->create(['btcaddress', 0.0034, ['label' => 'label']]);
|
||||
|
||||
$properFormat = 'bitcoin:btcaddress?amount=0.0034&label=label';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->btc));
|
||||
}
|
||||
|
||||
public function test_it_generates_a_valid_btc_qrcode_with_an_address_amount_label_message_and_return_address()
|
||||
{
|
||||
$this->btc->create([
|
||||
'btcaddress',
|
||||
0.0034,
|
||||
[
|
||||
'label' => 'label',
|
||||
'message' => 'message',
|
||||
'returnAddress' => 'https://www.returnaddress.com',
|
||||
],
|
||||
]);
|
||||
|
||||
$properFormat = 'bitcoin:btcaddress?amount=0.0034&label=label&message=message&r='.urlencode('https://www.returnaddress.com');
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->btc));
|
||||
}
|
||||
}
|
||||
55
vendor/simplesoftwareio/simple-qrcode/tests/DataTypes/EmailTest.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\DataTypes\Email;
|
||||
|
||||
class EmailTest extends TestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->email = new Email();
|
||||
}
|
||||
|
||||
public function test_it_generates_the_proper_format_when_only_an_email_address_is_supplied()
|
||||
{
|
||||
$this->email->create(['foo@bar.com']);
|
||||
|
||||
$properFormat = 'mailto:foo@bar.com';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->email));
|
||||
}
|
||||
|
||||
public function test_it_generates_the_proper_format_when_an_email_subject_and_body_are_supplied()
|
||||
{
|
||||
$this->email->create(['foo@bar.com', 'foo', 'bar']);
|
||||
|
||||
$properFormat = 'mailto:foo@bar.com?subject=foo&body=bar';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->email));
|
||||
}
|
||||
|
||||
public function test_it_generates_the_proper_format_when_an_email_and_subject_are_supplied()
|
||||
{
|
||||
$this->email->create(['foo@bar.com', 'foo']);
|
||||
|
||||
$properFormat = 'mailto:foo@bar.com?subject=foo';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->email));
|
||||
}
|
||||
|
||||
public function test_it_generates_the_proper_format_when_only_a_subject_is_provided()
|
||||
{
|
||||
$this->email->create([null, 'foo']);
|
||||
|
||||
$properFormat = 'mailto:?subject=foo';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->email));
|
||||
}
|
||||
|
||||
public function test_it_throws_an_exception_when_an_invalid_email_is_given()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$this->email->create(['foo']);
|
||||
}
|
||||
}
|
||||
17
vendor/simplesoftwareio/simple-qrcode/tests/DataTypes/GeoTest.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\DataTypes\Geo;
|
||||
|
||||
class GeoTest extends TestCase
|
||||
{
|
||||
public function test_it_generates_the_proper_format_for_a_geo_coordinate()
|
||||
{
|
||||
$geo = new Geo();
|
||||
$geo->create([10.254, -30.254]);
|
||||
|
||||
$properFormat = 'geo:10.254,-30.254';
|
||||
|
||||
$this->assertEquals($properFormat, strval($geo));
|
||||
}
|
||||
}
|
||||
17
vendor/simplesoftwareio/simple-qrcode/tests/DataTypes/PhoneNumberTest.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\DataTypes\PhoneNumber;
|
||||
|
||||
class PhoneNumberTest extends TestCase
|
||||
{
|
||||
public function test_it_generates_the_proper_format_for_calling_a_phone_number()
|
||||
{
|
||||
$phoneNumber = new PhoneNumber();
|
||||
$phoneNumber->create(['555-555-5555']);
|
||||
|
||||
$properFormat = 'tel:555-555-5555';
|
||||
|
||||
$this->assertEquals($properFormat, strval($phoneNumber));
|
||||
}
|
||||
}
|
||||
39
vendor/simplesoftwareio/simple-qrcode/tests/DataTypes/SMSTest.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\DataTypes\SMS;
|
||||
|
||||
class SMSTest extends TestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->sms = new SMS();
|
||||
}
|
||||
|
||||
public function test_it_generates_a_proper_format_with_a_phone_number()
|
||||
{
|
||||
$this->sms->create(['555-555-5555']);
|
||||
|
||||
$properFormat = 'sms:555-555-5555';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->sms));
|
||||
}
|
||||
|
||||
public function test_it_generate_a_proper_format_with_a_message()
|
||||
{
|
||||
$this->sms->create([null, 'foo']);
|
||||
|
||||
$properFormat = 'sms:&body=foo';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->sms));
|
||||
}
|
||||
|
||||
public function test_it_generates_a_proper_format_with_a_phone_number_and_message()
|
||||
{
|
||||
$this->sms->create(['555-555-5555', 'foo']);
|
||||
|
||||
$properFormat = 'sms:555-555-5555&body=foo';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->sms));
|
||||
}
|
||||
}
|
||||
70
vendor/simplesoftwareio/simple-qrcode/tests/DataTypes/WiFiTest.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\DataTypes\WiFi;
|
||||
|
||||
class WiFiTest extends TestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->wifi = new Wifi();
|
||||
}
|
||||
|
||||
public function test_it_generates_a_proper_format_with_just_the_ssid()
|
||||
{
|
||||
$this->wifi->create([
|
||||
0 => [
|
||||
'ssid' => 'foo',
|
||||
],
|
||||
]);
|
||||
|
||||
$properFormat = 'WIFI:S:foo;';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->wifi));
|
||||
}
|
||||
|
||||
public function test_it_generates_a_proper_format_for_a_ssid_that_is_hidden()
|
||||
{
|
||||
$this->wifi->create([
|
||||
0 => [
|
||||
'ssid' => 'foo',
|
||||
'hidden' => 'true',
|
||||
],
|
||||
]);
|
||||
|
||||
$properFormat = 'WIFI:S:foo;H:true;';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->wifi));
|
||||
}
|
||||
|
||||
public function test_it_generates_a_proper_format_for_a_ssid_encryption_and_password()
|
||||
{
|
||||
$this->wifi->create([
|
||||
0 => [
|
||||
'ssid' => 'foo',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'bar',
|
||||
],
|
||||
]);
|
||||
|
||||
$properFormat = 'WIFI:T:WPA;S:foo;P:bar;';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->wifi));
|
||||
}
|
||||
|
||||
public function test_it_generates_a_proper_format_for_a_ssid_encryption_password_and_is_hidden()
|
||||
{
|
||||
$this->wifi->create([
|
||||
0 => [
|
||||
'ssid' => 'foo',
|
||||
'encryption' => 'WPA',
|
||||
'password' => 'bar',
|
||||
'hidden' => 'true',
|
||||
],
|
||||
]);
|
||||
|
||||
$properFormat = 'WIFI:T:WPA;S:foo;P:bar;H:true;';
|
||||
|
||||
$this->assertEquals($properFormat, strval($this->wifi));
|
||||
}
|
||||
}
|
||||
214
vendor/simplesoftwareio/simple-qrcode/tests/GeneratorTest.php
vendored
Normal file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
use BaconQrCode\Renderer\Eye\SimpleCircleEye;
|
||||
use BaconQrCode\Renderer\Eye\SquareEye;
|
||||
use BaconQrCode\Renderer\Image\EpsImageBackEnd;
|
||||
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
|
||||
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
|
||||
use BaconQrCode\Renderer\Module\DotsModule;
|
||||
use BaconQrCode\Renderer\Module\RoundnessModule;
|
||||
use BaconQrCode\Renderer\Module\SquareModule;
|
||||
use BaconQrCode\Renderer\RendererStyle\Gradient;
|
||||
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\Generator;
|
||||
|
||||
class GeneratorTest extends TestCase
|
||||
{
|
||||
public function test_chaining_is_possible()
|
||||
{
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->size(100));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->format('eps'));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->color(255, 255, 255));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->backgroundColor(255, 255, 255));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->eyeColor(0, 255, 255, 255, 0, 0, 0));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->gradient(255, 255, 255, 0, 0, 0, 'vertical'));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->eye('circle'));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->style('round'));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->encoding('UTF-8'));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->errorCorrection('H'));
|
||||
$this->assertInstanceOf(Generator::class, (new Generator)->margin(2));
|
||||
}
|
||||
|
||||
public function test_size_is_passed_to_the_renderer()
|
||||
{
|
||||
$generator = (new Generator)->size(100);
|
||||
|
||||
$this->assertEquals(100, $generator->getRendererStyle()->getSize());
|
||||
}
|
||||
|
||||
public function test_format_sets_the_image_format()
|
||||
{
|
||||
// Disabled until GitHub actions config can be updated to pull in imagick
|
||||
// $generator = (new Generator)->format('png');
|
||||
// $this->assertInstanceOf(ImagickImageBackEnd::class, $generator->getFormatter());
|
||||
|
||||
$generator = (new Generator)->format('svg');
|
||||
$this->assertInstanceOf(SvgImageBackEnd::class, $generator->getFormatter());
|
||||
|
||||
$generator = (new Generator)->format('eps');
|
||||
$this->assertInstanceOf(EpsImageBackEnd::class, $generator->getFormatter());
|
||||
}
|
||||
|
||||
public function test_an_exception_is_thrown_if_an_unsupported_format_is_used()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
(new Generator)->format('foo');
|
||||
}
|
||||
|
||||
public function test_color_is_set()
|
||||
{
|
||||
$generator = (new Generator)->color(50, 75, 100);
|
||||
$this->assertEquals(50, $generator->getFill()->getForegroundColor()->toRgb()->getRed());
|
||||
$this->assertEquals(75, $generator->getFill()->getForegroundColor()->toRgb()->getGreen());
|
||||
$this->assertEquals(100, $generator->getFill()->getForegroundColor()->toRgb()->getBlue());
|
||||
|
||||
$generator = (new Generator)->color(50, 75, 100, 25);
|
||||
$this->assertEquals(25, $generator->getFill()->getForegroundColor()->getAlpha());
|
||||
$this->assertEquals(50, $generator->getFill()->getForegroundColor()->toRgb()->getRed());
|
||||
$this->assertEquals(75, $generator->getFill()->getForegroundColor()->toRgb()->getGreen());
|
||||
$this->assertEquals(100, $generator->getFill()->getForegroundColor()->toRgb()->getBlue());
|
||||
|
||||
$generator = (new Generator)->color(50, 75, 100, 0);
|
||||
$this->assertEquals(0, $generator->getFill()->getForegroundColor()->getAlpha());
|
||||
$this->assertEquals(50, $generator->getFill()->getForegroundColor()->toRgb()->getRed());
|
||||
$this->assertEquals(75, $generator->getFill()->getForegroundColor()->toRgb()->getGreen());
|
||||
$this->assertEquals(100, $generator->getFill()->getForegroundColor()->toRgb()->getBlue());
|
||||
}
|
||||
|
||||
public function test_background_color_is_set()
|
||||
{
|
||||
$generator = (new Generator)->backgroundColor(50, 75, 100);
|
||||
$this->assertEquals(50, $generator->getFill()->getBackgroundColor()->toRgb()->getRed());
|
||||
$this->assertEquals(75, $generator->getFill()->getBackgroundColor()->toRgb()->getGreen());
|
||||
$this->assertEquals(100, $generator->getFill()->getBackgroundColor()->toRgb()->getBlue());
|
||||
|
||||
$generator = (new Generator)->backgroundColor(50, 75, 100, 25);
|
||||
$this->assertEquals(25, $generator->getFill()->getBackgroundColor()->getAlpha());
|
||||
$this->assertEquals(50, $generator->getFill()->getBackgroundColor()->toRgb()->getRed());
|
||||
$this->assertEquals(75, $generator->getFill()->getBackgroundColor()->toRgb()->getGreen());
|
||||
$this->assertEquals(100, $generator->getFill()->getBackgroundColor()->toRgb()->getBlue());
|
||||
}
|
||||
|
||||
public function test_eye_color_is_set()
|
||||
{
|
||||
$generator = (new Generator)->eyeColor(0, 0, 0, 0, 255, 255, 255);
|
||||
$generator = $generator->eyeColor(1, 0, 0, 0, 255, 255, 255);
|
||||
$generator = $generator->eyeColor(2, 0, 0, 0, 255, 255, 255);
|
||||
|
||||
$this->assertEquals(0, $generator->getFill()->getTopLeftEyeFill()->getExternalColor()->getRed());
|
||||
$this->assertEquals(0, $generator->getFill()->getTopLeftEyeFill()->getExternalColor()->getGreen());
|
||||
$this->assertEquals(0, $generator->getFill()->getTopLeftEyeFill()->getExternalColor()->getBlue());
|
||||
$this->assertEquals(255, $generator->getFill()->getTopLeftEyeFill()->getInternalColor()->getRed());
|
||||
$this->assertEquals(255, $generator->getFill()->getTopLeftEyeFill()->getInternalColor()->getGreen());
|
||||
$this->assertEquals(255, $generator->getFill()->getTopLeftEyeFill()->getInternalColor()->getBlue());
|
||||
|
||||
$this->assertEquals(0, $generator->getFill()->getTopRightEyeFill()->getExternalColor()->getRed());
|
||||
$this->assertEquals(0, $generator->getFill()->getTopRightEyeFill()->getExternalColor()->getGreen());
|
||||
$this->assertEquals(0, $generator->getFill()->getTopRightEyeFill()->getExternalColor()->getBlue());
|
||||
$this->assertEquals(255, $generator->getFill()->getTopRightEyeFill()->getInternalColor()->getRed());
|
||||
$this->assertEquals(255, $generator->getFill()->getTopRightEyeFill()->getInternalColor()->getGreen());
|
||||
$this->assertEquals(255, $generator->getFill()->getTopRightEyeFill()->getInternalColor()->getBlue());
|
||||
|
||||
$generator = (new Generator)->eyeColor(2, 0, 0, 0, 255, 255, 255);
|
||||
$this->assertEquals(0, $generator->getFill()->getBottomLeftEyeFill()->getExternalColor()->getRed());
|
||||
$this->assertEquals(0, $generator->getFill()->getBottomLeftEyeFill()->getExternalColor()->getGreen());
|
||||
$this->assertEquals(0, $generator->getFill()->getBottomLeftEyeFill()->getExternalColor()->getBlue());
|
||||
$this->assertEquals(255, $generator->getFill()->getBottomLeftEyeFill()->getInternalColor()->getRed());
|
||||
$this->assertEquals(255, $generator->getFill()->getBottomLeftEyeFill()->getInternalColor()->getGreen());
|
||||
$this->assertEquals(255, $generator->getFill()->getBottomLeftEyeFill()->getInternalColor()->getBlue());
|
||||
}
|
||||
|
||||
public function test_eye_color_throws_exception_with_number_greater_than_2()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
(new Generator)->eyeColor(3, 0, 0, 0, 255, 255, 255);
|
||||
}
|
||||
|
||||
public function test_eye_color_throws_exception_with_negative_number()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
(new Generator)->eyeColor(-1, 0, 0, 0, 255, 255, 255);
|
||||
}
|
||||
|
||||
public function test_grandient_is_set()
|
||||
{
|
||||
$generator = (new Generator)->gradient(0, 0, 0, 255, 255, 255, 'vertical');
|
||||
$this->assertInstanceOf(Gradient::class, $generator->getFill()->getForegroundGradient());
|
||||
}
|
||||
|
||||
public function test_eye_style_is_set()
|
||||
{
|
||||
$generator = (new Generator)->eye('circle');
|
||||
$this->assertInstanceOf(SimpleCircleEye::class, $generator->getEye());
|
||||
|
||||
$generator = (new Generator)->eye('square');
|
||||
$this->assertInstanceOf(SquareEye::class, $generator->getEye());
|
||||
}
|
||||
|
||||
public function test_invalid_eye_throws_an_exception()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
(new Generator)->eye('foo');
|
||||
}
|
||||
|
||||
public function test_style_is_set()
|
||||
{
|
||||
$generator = (new Generator)->style('square');
|
||||
$this->assertInstanceOf(SquareModule::class, $generator->getModule());
|
||||
|
||||
$generator = (new Generator)->style('dot', .1);
|
||||
$this->assertInstanceOf(DotsModule::class, $generator->getModule());
|
||||
|
||||
$generator = (new Generator)->style('round', .3);
|
||||
$this->assertInstanceOf(RoundnessModule::class, $generator->getModule());
|
||||
}
|
||||
|
||||
public function test_an_exception_is_thrown_for_an_invalid_style()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
(new Generator)->style('foo');
|
||||
}
|
||||
|
||||
public function test_an_exception_is_thrown_for_a_number_over_1()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
(new Generator)->style('round', 1.1);
|
||||
}
|
||||
|
||||
public function test_an_exception_is_thrown_for_a_number_under_0()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
(new Generator)->style('round', -.1);
|
||||
}
|
||||
|
||||
public function test_an_exception_is_thrown_for_1()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
(new Generator)->style('round', 1);
|
||||
}
|
||||
|
||||
public function test_get_renderer_returns_renderer()
|
||||
{
|
||||
$this->assertInstanceOf(RendererStyle::class, (new Generator)->getRendererStyle());
|
||||
}
|
||||
|
||||
public function test_it_calls_a_valid_dynamic_method_and_generates_a_qrcode()
|
||||
{
|
||||
$result = (new Generator)->btc('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa');
|
||||
$this->assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"100\" height=\"100\" viewBox=\"0 0 100 100\"><rect x=\"0\" y=\"0\" width=\"100\" height=\"100\" fill=\"#ffffff\"/><g transform=\"scale(3.448)\"><g transform=\"translate(0,0)\"><path fill-rule=\"evenodd\" d=\"M8 0L8 1L10 1L10 0ZM15 0L15 1L16 1L16 2L15 2L15 3L14 3L14 2L11 2L11 4L10 4L10 3L9 3L9 2L8 2L8 5L9 5L9 6L8 6L8 7L9 7L9 8L8 8L8 10L6 10L6 9L7 9L7 8L6 8L6 9L5 9L5 10L6 10L6 11L7 11L7 12L6 12L6 13L7 13L7 14L6 14L6 15L5 15L5 14L4 14L4 13L5 13L5 12L4 12L4 13L3 13L3 11L4 11L4 10L3 10L3 9L4 9L4 8L0 8L0 11L1 11L1 12L0 12L0 14L2 14L2 15L1 15L1 16L2 16L2 17L1 17L1 18L0 18L0 19L1 19L1 18L2 18L2 19L3 19L3 20L5 20L5 16L6 16L6 17L7 17L7 18L6 18L6 19L7 19L7 20L6 20L6 21L8 21L8 22L9 22L9 21L10 21L10 23L13 23L13 24L12 24L12 25L11 25L11 24L10 24L10 27L9 27L9 25L8 25L8 29L9 29L9 28L10 28L10 29L11 29L11 28L12 28L12 26L14 26L14 29L16 29L16 28L17 28L17 29L19 29L19 28L20 28L20 29L21 29L21 28L22 28L22 27L23 27L23 29L24 29L24 28L25 28L25 29L26 29L26 28L25 28L25 27L27 27L27 29L28 29L28 27L29 27L29 24L28 24L28 22L29 22L29 19L28 19L28 21L27 21L27 19L26 19L26 18L27 18L27 17L25 17L25 16L26 16L26 15L29 15L29 13L27 13L27 12L26 12L26 13L25 13L25 14L26 14L26 15L24 15L24 14L23 14L23 13L24 13L24 12L25 12L25 11L26 11L26 10L25 10L25 9L27 9L27 11L28 11L28 12L29 12L29 11L28 11L28 10L29 10L29 8L28 8L28 9L27 9L27 8L24 8L24 9L23 9L23 11L22 11L22 12L21 12L21 11L19 11L19 10L21 10L21 9L22 9L22 8L21 8L21 9L20 9L20 7L21 7L21 6L20 6L20 2L19 2L19 5L18 5L18 4L17 4L17 3L16 3L16 2L17 2L17 0ZM19 0L19 1L20 1L20 0ZM12 3L12 5L10 5L10 6L9 6L9 7L10 7L10 8L9 8L9 9L10 9L10 10L8 10L8 12L7 12L7 13L9 13L9 12L10 12L10 13L11 13L11 11L13 11L13 10L14 10L14 12L15 12L15 13L20 13L20 14L21 14L21 16L22 16L22 17L21 17L21 19L22 19L22 20L23 20L23 18L25 18L25 17L24 17L24 15L22 15L22 14L21 14L21 12L18 12L18 11L16 11L16 9L18 9L18 8L19 8L19 7L20 7L20 6L19 6L19 7L18 7L18 5L17 5L17 4L16 4L16 5L14 5L14 6L13 6L13 7L12 7L12 5L13 5L13 3ZM16 5L16 7L15 7L15 6L14 6L14 7L15 7L15 8L14 8L14 10L15 10L15 8L18 8L18 7L17 7L17 5ZM10 6L10 7L11 7L11 8L12 8L12 7L11 7L11 6ZM23 11L23 12L22 12L22 13L23 13L23 12L24 12L24 11ZM1 12L1 13L2 13L2 14L3 14L3 13L2 13L2 12ZM12 12L12 14L8 14L8 15L6 15L6 16L8 16L8 18L7 18L7 19L8 19L8 21L9 21L9 20L10 20L10 21L11 21L11 22L12 22L12 21L11 21L11 20L12 20L12 19L11 19L11 18L12 18L12 17L13 17L13 18L17 18L17 19L16 19L16 20L15 20L15 21L14 21L14 19L13 19L13 23L14 23L14 22L15 22L15 24L14 24L14 26L15 26L15 27L16 27L16 26L17 26L17 28L18 28L18 26L17 26L17 25L20 25L20 22L19 22L19 23L18 23L18 21L17 21L17 19L18 19L18 20L20 20L20 18L18 18L18 17L17 17L17 16L18 16L18 15L19 15L19 14L17 14L17 16L16 16L16 17L15 17L15 15L16 15L16 14L15 14L15 15L14 15L14 13L13 13L13 12ZM26 13L26 14L27 14L27 13ZM12 14L12 16L11 16L11 15L9 15L9 18L8 18L8 19L9 19L9 18L10 18L10 17L12 17L12 16L13 16L13 14ZM3 15L3 17L2 17L2 18L3 18L3 17L4 17L4 15ZM19 16L19 17L20 17L20 16ZM28 16L28 17L29 17L29 16ZM24 19L24 20L25 20L25 19ZM1 20L1 21L2 21L2 20ZM15 21L15 22L16 22L16 23L17 23L17 21ZM21 21L21 24L24 24L24 21ZM22 22L22 23L23 23L23 22ZM25 22L25 23L26 23L26 24L27 24L27 22ZM15 24L15 26L16 26L16 25L17 25L17 24ZM22 25L22 26L23 26L23 25ZM24 25L24 27L25 27L25 26L27 26L27 27L28 27L28 25ZM19 26L19 27L21 27L21 26ZM0 0L0 7L7 7L7 0ZM1 1L1 6L6 6L6 1ZM2 2L2 5L5 5L5 2ZM22 0L22 7L29 7L29 0ZM23 1L23 6L28 6L28 1ZM24 2L24 5L27 5L27 2ZM0 22L0 29L7 29L7 22ZM1 23L1 28L6 28L6 23ZM2 24L2 27L5 27L5 24Z\" fill=\"#000000\"/></g></g></svg>\n", $result);
|
||||
}
|
||||
|
||||
public function test_it_throws_an_exception_if_datatype_is_not_found()
|
||||
{
|
||||
$this->expectException(BadMethodCallException::class);
|
||||
(new Generator)->notReal('fooBar');
|
||||
}
|
||||
|
||||
public function test_generator_can_return_illuminate_support_htmlstring()
|
||||
{
|
||||
$this->getMockBuilder(\Illuminate\Support\HtmlString::class)->getMock();
|
||||
$this->assertInstanceOf(\Illuminate\Support\HtmlString::class, (new Generator)->generate('fooBar'));
|
||||
}
|
||||
}
|
||||
94
vendor/simplesoftwareio/simple-qrcode/tests/ImageMergeTest.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\Image;
|
||||
use SimpleSoftwareIO\QrCode\ImageMerge;
|
||||
|
||||
class ImageMergeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* The location to save the testing image.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $testImageSaveLocation;
|
||||
|
||||
/**
|
||||
* The location to save the compare image.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $compareTestSaveLocation;
|
||||
|
||||
/**
|
||||
* The ImageMerge Object.
|
||||
*
|
||||
* @var ImageMerge
|
||||
*/
|
||||
protected $testImage;
|
||||
|
||||
/**
|
||||
* The location of the test image that is having an image merged over top of it.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $testImagePath;
|
||||
|
||||
/**
|
||||
* The location of the test image that is being merged.
|
||||
* @var mixed
|
||||
*/
|
||||
protected $mergeImagePath;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->testImagePath = file_get_contents(dirname(__FILE__).'/Images/simplesoftware-icon-grey-blue.png');
|
||||
$this->mergeImagePath = file_get_contents(dirname(__FILE__).'/Images/200x300.png');
|
||||
$this->testImage = new ImageMerge(
|
||||
new Image($this->testImagePath),
|
||||
new Image($this->mergeImagePath)
|
||||
);
|
||||
|
||||
$this->testImageSaveLocation = dirname(__FILE__).'/testImage.png';
|
||||
$this->compareTestSaveLocation = dirname(__FILE__).'/compareImage.png';
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
{
|
||||
@unlink($this->testImageSaveLocation);
|
||||
@unlink($this->compareTestSaveLocation);
|
||||
}
|
||||
|
||||
public function test_it_merges_two_images_together_and_centers_it()
|
||||
{
|
||||
//We know the source image is 512x512 and the merge image is 200x300
|
||||
$source = imagecreatefromstring($this->testImagePath);
|
||||
$merge = imagecreatefromstring($this->mergeImagePath);
|
||||
|
||||
//Create a PNG and place the image in the middle using 20% of the area.
|
||||
imagecopyresampled(
|
||||
$source,
|
||||
$merge,
|
||||
205,
|
||||
222,
|
||||
0,
|
||||
0,
|
||||
102,
|
||||
67,
|
||||
536,
|
||||
354
|
||||
);
|
||||
imagepng($source, $this->compareTestSaveLocation);
|
||||
|
||||
$testImage = $this->testImage->merge(.2);
|
||||
file_put_contents($this->testImageSaveLocation, $testImage);
|
||||
|
||||
$this->assertEquals(file_get_contents($this->compareTestSaveLocation), file_get_contents($this->testImageSaveLocation));
|
||||
}
|
||||
|
||||
public function test_it_throws_an_exception_when_percentage_is_greater_than_1()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->testImage->merge(1.1);
|
||||
}
|
||||
}
|
||||
82
vendor/simplesoftwareio/simple-qrcode/tests/ImageTest.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SimpleSoftwareIO\QrCode\Image;
|
||||
|
||||
class ImageTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* The location to save the testing image.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $testImageSaveLocation;
|
||||
|
||||
/**
|
||||
* The location to save the compare image.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $compareTestSaveLocation;
|
||||
|
||||
/**
|
||||
* The path to the image used to test.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $imagePath;
|
||||
|
||||
/**
|
||||
* The Image object.
|
||||
*
|
||||
* @var Image
|
||||
*/
|
||||
protected $image;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->imagePath = file_get_contents(dirname(__FILE__).'/Images/simplesoftware-icon-grey-blue.png');
|
||||
$this->image = new Image($this->imagePath);
|
||||
|
||||
$this->testImageSaveLocation = dirname(__FILE__).'/testImage.png';
|
||||
$this->compareTestSaveLocation = dirname(__FILE__).'/compareImage.png';
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
{
|
||||
@unlink($this->testImageSaveLocation);
|
||||
@unlink($this->compareTestSaveLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Must test that the outputted PNG is the same because you can not compare resources.
|
||||
*/
|
||||
public function test_it_loads_an_image_string_into_a_resource()
|
||||
{
|
||||
imagepng(imagecreatefromstring($this->imagePath), $this->compareTestSaveLocation);
|
||||
imagepng($this->image->getImageResource(), $this->testImageSaveLocation);
|
||||
|
||||
$correctImage = file_get_contents($this->compareTestSaveLocation);
|
||||
$testImage = file_get_contents($this->testImageSaveLocation);
|
||||
|
||||
$this->assertEquals($correctImage, $testImage);
|
||||
}
|
||||
|
||||
public function test_it_gets_the_correct_height()
|
||||
{
|
||||
$correctHeight = 512;
|
||||
|
||||
$testHeight = $this->image->getHeight();
|
||||
|
||||
$this->assertEquals($correctHeight, $testHeight);
|
||||
}
|
||||
|
||||
public function test_it_gets_the_correct_width()
|
||||
{
|
||||
$correctWidth = 512;
|
||||
|
||||
$testWidth = $this->image->getWidth();
|
||||
|
||||
$this->assertEquals($correctWidth, $testWidth);
|
||||
}
|
||||
}
|
||||
BIN
vendor/simplesoftwareio/simple-qrcode/tests/Images/200x300.png
vendored
Normal file
|
After Width: | Height: | Size: 232 KiB |
BIN
vendor/simplesoftwareio/simple-qrcode/tests/Images/simplesoftware-icon-grey-blue.png
vendored
Normal file
|
After Width: | Height: | Size: 18 KiB |