diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00ea4ff..7331da1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +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! \ No newline at end of file +Please submit all issues and pull requests to the [billyljren/easy-qrcode](https://github.com/billyljren/easy-qrcode) repository on the develop branch! diff --git a/LICENSE b/LICENSE index 5a20219..9b31b29 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2020 Simple Software LLC www.simplesoftware.io +Copyright (c) 2014-2020 Beacon Systems Sdn Bhd www.beaconsbay.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 01bbbd7..22f8a78 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Simple QrCode +Easy QRCode ========================  @@ -7,34 +7,12 @@ 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) | [العربية](https://www.simplesoftware.io/#/docs/simple-qrcode/ar) - -Language files are currently out of date. We need volunteers to upgrade them to v4! Please submit a PR request! - ## 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 -
-
-
-
-
- Platform to sell tickets online -
+Simple QrCode is an easy to use wrapper for the popular Laravel framework based on [Simple-QrCode](https://github.com/SimpleSoftwareIO/simple-qrcode) which is a wrapper on [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). We created an interface that is familiar and easy to install for Laravel users. Now with better documentation on how to use it's functionality. -## Contributing +## Full Documentation -Please submit all issues and pull requests to the [simplesoftwareio/simple-qrcode](https://github.com/simplesoftwareio/simple-qrcode) repository on the develop branch! +https://github.com/billyljren/easy-qrcode/blob/develop/docs/en/README.md ## License diff --git a/SECURITY.md b/SECURITY.md index 2a3758d..3fe6d79 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,11 +4,8 @@ | Version | Supported | | ------- | ------------------ | -| >= 2.x | :white_check_mark: | -| <= 1.x | :x: | +| >= 1.x | :white_check_mark: | ## 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. +Please raise an any issues within GitHub diff --git a/composer.json b/composer.json index 8594a91..1a97d23 100644 --- a/composer.json +++ b/composer.json @@ -1,19 +1,20 @@ { - "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", + "name": "billyljren/easy-qrcode", + "description": "Easy QRCode is a QR code generator made for Laravel.", + "keywords": ["qrcode", "laravel", "easy", "svg", "png", "simple", "bacon", "generator", "wrapper"], + "homepage": "https://github.com/billyljren/easy-qrcode", "license" : "MIT", "authors": [ { - "name": "Simple Software LLC", - "email": "support@simplesoftware.io" + "name": "Beacon Systems Sdn Bhd", + "email": "info@beaconsbay.com" } ], "require": { "php": ">=7.2|^8.0", "ext-gd": "*", - "bacon/bacon-qr-code": "^2.0" + "bacon/bacon-qr-code": "^2.0", + "meyfa/php-svg": "^0.15.0" }, "require-dev": { "mockery/mockery": "~1", @@ -25,7 +26,7 @@ }, "autoload": { "psr-4": { - "SimpleSoftwareIO\\QrCode\\": "src" + "BeaconsBay\\QrCode\\": "src" } }, "scripts": { @@ -34,10 +35,10 @@ "extra": { "laravel": { "providers": [ - "SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider" + "BeaconsBay\\QrCode\\QrCodeServiceProvider" ], "aliases": { - "QrCode": "SimpleSoftwareIO\\QrCode\\Facades\\QrCode" + "QrCode": "BeaconsBay\\QrCode\\Facades\\QrCode" } } } diff --git a/docs/en/README.md b/docs/en/README.md index 4df2d3c..c77cd64 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -1,56 +1,28 @@ -[](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 -
-
-
-
-
- Platform to sell tickets online -
- ## 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. +Easy 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.   -## Upgrade Guide - -Upgrade from v2 or v3 by changing your `composer.json` file to `~4` +## Requirements 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; +use BeaconsBay\QrCode\Facades\QrCode; ``` ## Configuration -#### Composer +#### Install via Composer -Run `composer require simplesoftwareio/simple-qrcode "~4"` to add the package. - -Laravel will automatically pick up and install the package. +Run `composer require billyljren/easy-qrcode` ## Simple Ideas @@ -72,6 +44,7 @@ You may embed a qrcode inside of an e-mail to allow your users to quickly scan.
+
## Usage
#### Basic Usage
@@ -79,12 +52,12 @@ You may embed a qrcode inside of an e-mail to allow your users to quickly scan.
```
// 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;
+use BeaconsBay\QrCode\Facades\QrCode;
```
Using the QrCode Generator is very easy. The most basic syntax is:
- use SimpleSoftwareIO\QrCode\Facades\QrCode;
+ use BeaconsBay\QrCode\Facades\QrCode;
QrCode::generate('Make me into a QrCode!');
@@ -400,20 +373,20 @@ This helpers makes scannable QrCodes that can connect a phone to a WiFi network:
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');
+ QrCode::generate('http://www.beaconx.com.my');
| 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 |
+| Website URL | http:// | http://www.beaconx..com.my |
+| Secured URL | https:// | https://www.beaconx.com.my |
+| E-mail Address | mailto: | mailto:support@beaconsbay.com |
| 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; |
+| MeCard | mecard: | MECARD:Beacon, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@beaconsbay.com; |
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
@@ -422,7 +395,7 @@ You can use a prefix found in the table below inside the `generate` section to c
You may use this package outside of Laravel by instantiating a new `Generator` class.
- use SimpleSoftwareIO\QrCode\Generator;
+ use BeaconsBay\QrCode\Generator;
$qrcode = new Generator;
$qrcode->size(500)->generate('Make a qrcode without Laravel!');
diff --git a/src/DataTypes/BTC.php b/src/DataTypes/BTC.php
index fa55d81..6575134 100644
--- a/src/DataTypes/BTC.php
+++ b/src/DataTypes/BTC.php
@@ -1,6 +1,6 @@
merge($this->imagePercentage);
}
+ if ($this->imageMerge !== null && $this->format === 'svg') {
+ $merge = new ImageMergeSvg(new SVGString($qrCode), new SVGString($this->imageMerge));
+ $qrCode = $merge->merge($this->imagePercentage);
+ }
+
+
if ($filename) {
file_put_contents($filename, $qrCode);
diff --git a/src/Image.php b/src/Image.php
index 02bd83c..ae2d63b 100644
--- a/src/Image.php
+++ b/src/Image.php
@@ -1,6 +1,6 @@
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);
+ /* */
+ $svg1 = $this->sourceImage; //qrcode
+ $svg2 = $this->mergeImage; //logo
+ $svg2 = $svg2->setAttributeSvg($this->centerX, $this->centerY, $percentage);
+ $svg1 = $svg1->addChildren($svg2);
+ return $svg1;
+ }
+
+ /**
+ * 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);
+ }
+}
diff --git a/src/QrCodeServiceProvider.php b/src/QrCodeServiceProvider.php
index da37eb9..ff6eefe 100644
--- a/src/QrCodeServiceProvider.php
+++ b/src/QrCodeServiceProvider.php
@@ -1,6 +1,6 @@
image = SVG::fromString($image);
+ }
+
+ private function getdocument()
+ {
+ return $this->image->getDocument();
+ }
+
+ /*
+ * Returns the width of an image
+ *
+ * @return int
+ */
+ public function getWidth()
+ {
+ return (int) $this->image->getdocument()->getWidth();
+ }
+
+ /*
+ * Returns the height of an image
+ *
+ * @return int
+ */
+ public function getHeight()
+ {
+ return (int) $this->image->getdocument()->getHeight();
+ }
+
+ /**
+ * Returns the image string.
+ *
+ * @return string
+ */
+ public function getImageResource()
+ {
+ return $this->image;
+ }
+
+
+ public function setAttributeSvg(int $centerX, int $centerY, float $percentage)
+ {
+ return $this->image->getdocument()->getChild(0)->setAttribute('transform', 'translate(' . $centerX . ',' . $centerY . ') scale(' . $percentage . ')');
+ }
+
+ public function addChildren(SVGGroup $image)
+ {
+ $this->image->getdocument()->addChild($image);
+ $image = $this->image->toXmlString();
+ return $image;
+ }
+ /**
+ * Sets the image string.
+ *
+ * @param resource $image
+ */
+ public function setImageResource($image)
+ {
+ $this->image = $image;
+ }
+}
diff --git a/tests/DataTypes/BTCTest.php b/tests/DataTypes/BTCTest.php
index 04b3e49..92d6f42 100644
--- a/tests/DataTypes/BTCTest.php
+++ b/tests/DataTypes/BTCTest.php
@@ -1,7 +1,7 @@