diff --git a/README.md b/README.md
index d72f02ae1..7588a2274 100644
--- a/README.md
+++ b/README.md
@@ -61,8 +61,9 @@ It also features a QR Code reader based on a [PHP port](https://github.com/khana
- [`ext-imagick`](https://github.com/Imagick/imagick) with [ImageMagick](https://imagemagick.org) installed
- [`ext-fileinfo`](https://www.php.net/manual/book.fileinfo.php) (required by `QRImagick` output)
- [`setasign/fpdf`](https://github.com/setasign/fpdf) for the PDF output module
+ - [`intervention/image`](https://github.com/Intervention/image) for alternative GD/ImageMagick output
-For the QRCode reader, either `ext-gd` or `ext-imagick` is required!
+For the QR Code reader, either `ext-gd` or `ext-imagick` is required!
# Documentation
diff --git a/docs/Built-In-Output/QREps.md b/docs/Built-In-Output/QREps.md
index 730588000..63cedb994 100644
--- a/docs/Built-In-Output/QREps.md
+++ b/docs/Built-In-Output/QREps.md
@@ -1,6 +1,7 @@
# QREps
-[Class `QREps`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QREps.php): [Encapsulated Postscript](https://en.wikipedia.org/wiki/Encapsulated_PostScript) (EPS) output.
+[Class `QREps`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QREps.php):
+[Encapsulated Postscript](https://en.wikipedia.org/wiki/Encapsulated_PostScript) (EPS) output.
## Example
@@ -50,6 +51,7 @@ echo (new QRCode($options))->render($data);
exit;
```
+
## Additional methods
| method | return | description |
@@ -67,15 +69,3 @@ exit;
| `$drawLightModules` | `bool` |
| `$excludeFromConnect` | `array` |
| `$scale` | `int` |
-
-
-### Options that have no effect
-
-| property | reason |
-|------------------------|-----------------|
-| `$circleRadius` | not implemented |
-| `$drawCircularModules` | not implemented |
-| `$outputBase64` | N/A |
-| `$imageTransparent` | N/A |
-| `$keepAsSquare` | not implemented |
-| `$returnResource` | N/A |
diff --git a/docs/Built-In-Output/QRFpdf.md b/docs/Built-In-Output/QRFpdf.md
index 3bda31410..ff6c2cd3b 100644
--- a/docs/Built-In-Output/QRFpdf.md
+++ b/docs/Built-In-Output/QRFpdf.md
@@ -1,6 +1,7 @@
# QRFpdf
-[Class `QRFpdf`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QRFpdf.php): [Portable Document Format](https://en.wikipedia.org/wiki/PDF) (PDF) output via [FPDF](https://github.com/setasign/fpdf)
+[Class `QRFpdf`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QRFpdf.php):
+[Portable Document Format](https://en.wikipedia.org/wiki/PDF) (PDF) output via [FPDF](https://github.com/setasign/fpdf).
## Example
@@ -74,15 +75,3 @@ echo $fpdf->Output('S');
| `$outputBase64` | `bool` |
| `$returnResource` | `bool` |
| `$scale` | `ìnt` |
-
-
-### Options that have no effect
-
-| property | reason |
-|------------------------|--------|
-| `$circleRadius` | N/A |
-| `$connectPaths` | N/A |
-| `$drawCircularModules` | N/A |
-| `$excludeFromConnect` | N/A |
-| `$imageTransparent` | N/A |
-| `$keepAsSquare` | N/A |
diff --git a/docs/Built-In-Output/QRGdImage.md b/docs/Built-In-Output/QRGdImage.md
index 8fbfcb7ca..7fd0dfe92 100644
--- a/docs/Built-In-Output/QRGdImage.md
+++ b/docs/Built-In-Output/QRGdImage.md
@@ -1,6 +1,7 @@
# QRGdImage
-[Class `QRGdImage`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QRGdImage.php): [GdImage](https://www.php.net/manual/book.image) raster graphic output (GIF, JPG, PNG)
+[Class `QRGdImage`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QRGdImage.php):
+[GdImage](https://www.php.net/manual/book.image) raster graphic output (GIF, JPG, PNG, ...)
## Example
@@ -51,12 +52,12 @@ printf('
', $alt, $out);
```
-Return the `GdImage` instance/resource (will ignore other output options):
+Return the `GdImage` instance (will ignore other output options):
```php
$options->returnResource = true;
-/** @var \GdImage|resource $gdImage */
+/** @var \GdImage $gdImage */
$gdImage = (new QRCode($options))->render($data);
// do stuff with the GdImage instance...
@@ -73,13 +74,14 @@ imagedestroy($gdImage);
## Additional methods
-| method | return | description |
-|---------------------------------------------------|----------|-------------------------------------------------------------------|
-| (protected) `drawImage()` | `void` | Draws the QR image |
-| (protected) `dumpImage()` | `string` | Creates the final image by calling the desired GD output function |
-| (protected) `module(int $x, int $y, int $M_TYPE)` | `void` | Renders a single module |
-| (protected) `setBgColor()` | `void` | Sets the background color |
-| (protected) `setTransparencyColor()` | `void` | Sets the transparency color |
+| method | return | description |
+|---------------------------------------------------|----------|--------------------------------------------------------------------------------------------------|
+| (protected) `drawImage()` | `void` | Draws the QR image |
+| (protected) `dumpImage()` | `string` | Creates the final image by calling the desired GD output function |
+| (protected) `module(int $x, int $y, int $M_TYPE)` | `void` | Renders a single module |
+| (protected) `setBgColor()` | `void` | Sets the background color |
+| (protected) `setTransparencyColor()` | `void` | Sets the transparency color |
+| (abstract protected) `renderImage()` | `void` | Renders the image with the gdimage function for the desired output, implemented by child classes |
## Options that affect this module
@@ -97,11 +99,3 @@ imagedestroy($gdImage);
| `$returnResource` | `bool` |
| `$scale` | `int` |
| `$transparencyColor` | `mixed` |
-
-
-### Options that have no effect
-
-| property | reason |
-|-----------------------|--------|
-| `$connectPaths` | N/A |
-| `$excludeFromConnect` | N/A |
diff --git a/docs/Built-In-Output/QRImagick.md b/docs/Built-In-Output/QRImagick.md
index b1068ab63..24ce09600 100644
--- a/docs/Built-In-Output/QRImagick.md
+++ b/docs/Built-In-Output/QRImagick.md
@@ -102,11 +102,3 @@ echo $imagick->getImageBlob();
| `$returnResource` | `bool` |
| `$scale` | `int` |
| `$transparencyColor` | `mixed` |
-
-
-### Options that have no effect
-
-| property | reason |
-|-----------------------|--------|
-| `$connectPaths` | N/A |
-| `$excludeFromConnect` | N/A |
diff --git a/docs/Built-In-Output/QRInterventionImage.md b/docs/Built-In-Output/QRInterventionImage.md
new file mode 100644
index 000000000..e747d3c35
--- /dev/null
+++ b/docs/Built-In-Output/QRInterventionImage.md
@@ -0,0 +1,102 @@
+# QRInterventionImage
+
+[Class `QRInterventionImage`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QRInterventionImage.php):
+[intervention/image](https://image.intervention.io/) alternative GD/ImageMagick output.
+
+***Note:** this output class works significantly slower than the native GD/Imagick output classes due to the several underlying abstraction layers. Use only if you must.*
+
+
+## Example
+
+See: [intervention/image example](https://github.com/chillerlan/php-qrcode/blob/main/examples/intervention-image.php)
+
+Set the options:
+
+```php
+$options = new QROptions;
+
+$options->outputInterface = QRInterventionImage::class;
+$options->scale = 20;
+$options->bgColor = '#ccccaa';
+$options->imageTransparent = false;
+$options->transparencyColor = '#ccccaa';
+$options->drawLightModules = false;
+$options->drawCircularModules = true;
+$options->circleRadius = 0.4;
+$options->keepAsSquare = [
+ QRMatrix::M_FINDER_DARK,
+ QRMatrix::M_FINDER_DOT,
+ QRMatrix::M_ALIGNMENT_DARK,
+];
+$options->moduleValues = [
+ QRMatrix::M_FINDER_DARK => '#A71111', // dark (true)
+ QRMatrix::M_FINDER_DOT => '#A71111', // finder dot, dark (true)
+ QRMatrix::M_FINDER => '#FFBFBF', // light (false)
+ QRMatrix::M_ALIGNMENT_DARK => '#A70364',
+ QRMatrix::M_ALIGNMENT => '#FFC9C9',
+ QRMatrix::M_VERSION_DARK => '#650098',
+ QRMatrix::M_VERSION => '#E0B8FF',
+];
+```
+
+
+Render the output:
+
+```php
+$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
+$out = (new QRCode($options))->render($data); // -> data:image/png;base64,...
+
+printf('
', $alt, $out);
+```
+
+
+Return the `ImageInterface` instance (will ignore other output options):
+
+```php
+$options->returnResource = true;
+
+/** @var \Intervention\Image\Interfaces\ImageInterface $image */
+$image = (new QRCode($options))->render($data);
+
+// do stuff with the ImageInterface instance...
+
+// ...dump output
+
+header('Content-type: image/png');
+
+echo $image->toPng()->toString();
+```
+
+Set a different driver in the internal `ImageManager` instance (the internal detection order is: 1. GD, 2. Imagick):
+
+```php
+$qrOutputInterface = new QRInterventionImage($options, $matrix);
+// set a different driver
+$qrOutputInterface->setDriver(new \Intervention\Image\Drivers\Imagick\Driver);
+// dump output
+$out = $qrOutputInterface->dump();
+```
+
+
+## Additional methods
+
+| method | return | description |
+|--------------------------------------|----------|----------------------------------------------------------------------------------------------------------------------|
+| `setDriver(DriverInterface $driver)` | `static` | Sets a DriverInterface, see [instantiation (intervention.io)](https://image.intervention.io/v3/basics/instantiation) |
+| (protected) `module()` | `void` | Draws a single pixel at the given position |
+
+
+## Options that affect this module
+
+| property | type |
+|------------------------|----------|
+| `$bgColor` | `mixed` |
+| `$circleRadius` | `float` |
+| `$drawCircularModules` | `bool` |
+| `$drawLightModules` | `bool` |
+| `$imageTransparent` | `bool` |
+| `$keepAsSquare` | `array` |
+| `$outputBase64` | `bool` |
+| `$returnResource` | `bool` |
+| `$scale` | `int` |
+| `$transparencyColor` | `mixed` |
diff --git a/docs/Built-In-Output/QRMarkupSVG.md b/docs/Built-In-Output/QRMarkupSVG.md
index 298c8f631..082bf5feb 100644
--- a/docs/Built-In-Output/QRMarkupSVG.md
+++ b/docs/Built-In-Output/QRMarkupSVG.md
@@ -1,10 +1,12 @@
# QRMarkupSVG
-[Class `QRMarkupSVG`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QRMarkupSVG.php): [Scalable Vector Graphics](https://developer.mozilla.org/en-US/docs/Glossary/SVG) (SVG) output
+[Class `QRMarkupSVG`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QRMarkupSVG.php):
+[Scalable Vector Graphics](https://developer.mozilla.org/en-US/docs/Glossary/SVG) (SVG) output.
+
## Example
-See: [ImageMagick example](https://github.com/chillerlan/php-qrcode/blob/main/examples/imagick.php)
+See: [SVG example](https://github.com/chillerlan/php-qrcode/blob/main/examples/svg.php)
Set the options:
@@ -62,13 +64,14 @@ printf('
', $alt, $out);
| method | return | description |
|---------------------------------------------------|----------|---------------------------------------------------------------|
| (protected) `getCssClass(int $M_TYPE = 0)` | `string` | returns a string with all css classes for the current element |
+| (protected) `getViewBox()` | `string` | returns the value for the SVG viewBox attribute |
| (protected) `header()` | `string` | returns the `