diff --git a/application/views/tpl/oecaptcha.tpl b/application/views/tpl/oecaptcha.tpl index 93e2f84..8844a92 100644 --- a/application/views/tpl/oecaptcha.tpl +++ b/application/views/tpl/oecaptcha.tpl @@ -9,7 +9,7 @@
[{if $oCaptcha->isImageVisible()}] - + [{else}] [{$oCaptcha->getText()}] [{/if}] diff --git a/application/views/tpl/oecaptcha_wave.tpl b/application/views/tpl/oecaptcha_wave.tpl index f0ae2f6..c7eaeb8 100644 --- a/application/views/tpl/oecaptcha_wave.tpl +++ b/application/views/tpl/oecaptcha_wave.tpl @@ -9,7 +9,7 @@
[{if $oCaptcha->isImageVisible()}] - + [{else}] [{$oCaptcha->getText()}] [{/if}] diff --git a/composer.json b/composer.json index b24f871..3b0a3df 100644 --- a/composer.json +++ b/composer.json @@ -12,5 +12,8 @@ "oxideshop": { "target-directory": "oe/captcha" } + }, + "require": { + "mobicms/captcha": "^4.0" } } diff --git a/core/oecaptcha.php b/core/oecaptcha.php index 2959fc6..240d2ba 100644 --- a/core/oecaptcha.php +++ b/core/oecaptcha.php @@ -4,6 +4,8 @@ */ use OxidEsales\Eshop\Core\DatabaseProvider; +use Mobicms\Captcha\Image; +use Mobicms\Captcha\ImageOptions; /** * Class handling CAPTCHA image @@ -124,6 +126,20 @@ class oeCaptcha extends oxSuperCfg return $url; } + public function getBase64Image() + { + $fontsPath = __DIR__ . '/../fonts'; + $img = new Image($this->getText(), (new ImageOptions())->setFontsFolder($fontsPath)->setHeight(45) + ->setWidth(160) + ->adjustFont('baby_blocks.ttf', 13) + ->adjustFont('ball.ttf', 20) + ->adjustFont('chintzy.ttf', 18) + ->adjustFont('platinumhubcapsspoked.ttf', 20) + ->adjustFont('subway.ttf', 20) + ); + return (string) $img; + } + /** * Checks if image could be generated * diff --git a/fonts/baby_blocks.ttf b/fonts/baby_blocks.ttf new file mode 100644 index 0000000..cd99dc7 Binary files /dev/null and b/fonts/baby_blocks.ttf differ diff --git a/fonts/baby_blocks.txt b/fonts/baby_blocks.txt new file mode 100644 index 0000000..7de8e25 --- /dev/null +++ b/fonts/baby_blocks.txt @@ -0,0 +1,2 @@ +Developer: Ryan D. Neaveill + License: Unknown \ No newline at end of file diff --git a/fonts/ball.ttf b/fonts/ball.ttf new file mode 100644 index 0000000..14f2da5 Binary files /dev/null and b/fonts/ball.ttf differ diff --git a/fonts/betsy_flanagan.ttf b/fonts/betsy_flanagan.ttf new file mode 100644 index 0000000..73c4550 Binary files /dev/null and b/fonts/betsy_flanagan.ttf differ diff --git a/fonts/bloktilt.ttf b/fonts/bloktilt.ttf new file mode 100644 index 0000000..5205676 Binary files /dev/null and b/fonts/bloktilt.ttf differ diff --git a/fonts/cangoods.ttf b/fonts/cangoods.ttf new file mode 100644 index 0000000..57ce0a4 Binary files /dev/null and b/fonts/cangoods.ttf differ diff --git a/fonts/chintzy.ttf b/fonts/chintzy.ttf new file mode 100644 index 0000000..e6c115a Binary files /dev/null and b/fonts/chintzy.ttf differ diff --git a/fonts/elevator_buttons.ttf b/fonts/elevator_buttons.ttf new file mode 100644 index 0000000..ceb3ef8 Binary files /dev/null and b/fonts/elevator_buttons.ttf differ diff --git a/fonts/karmaticarcade.ttf b/fonts/karmaticarcade.ttf new file mode 100644 index 0000000..d1df852 Binary files /dev/null and b/fonts/karmaticarcade.ttf differ diff --git a/fonts/platinumhubcapsspoked.ttf b/fonts/platinumhubcapsspoked.ttf new file mode 100644 index 0000000..fa893ac Binary files /dev/null and b/fonts/platinumhubcapsspoked.ttf differ diff --git a/fonts/subway.ttf b/fonts/subway.ttf new file mode 100644 index 0000000..fa02ea7 Binary files /dev/null and b/fonts/subway.ttf differ diff --git a/fonts/tonight.ttf b/fonts/tonight.ttf new file mode 100644 index 0000000..be84738 Binary files /dev/null and b/fonts/tonight.ttf differ