]> Raphaƫl G. Git Repositories - packbundle/blobdiff - Controller/ImageController.php
Php 8.x constructor style
[packbundle] / Controller / ImageController.php
index 83516532cb5932d4e254f809b7504dcd52642c24..63143611c59c5a0797623d4862d9f7d62e68246b 100644 (file)
@@ -35,13 +35,6 @@ class ImageController extends AbstractController implements ServiceSubscriberInt
         */
        protected string $cache;
 
         */
        protected string $cache;
 
-       /**
-        * The ContainerInterface instance
-        *
-        * @var ContainerInterface 
-        */
-       protected $container;
-
        /**
         * The ImageUtil instance
         */
        /**
         * The ImageUtil instance
         */
@@ -50,7 +43,7 @@ class ImageController extends AbstractController implements ServiceSubscriberInt
        /**
         * The public path
         */
        /**
         * The public path
         */
-       protected string $public;
+       protected string $path;
 
        /**
         * The SluggerUtil instance
 
        /**
         * The SluggerUtil instance
@@ -64,11 +57,12 @@ class ImageController extends AbstractController implements ServiceSubscriberInt
         * @param ImageUtil $image The MapUtil instance
         * @param SluggerUtil $slugger The SluggerUtil instance
         * @param string $cache The cache path
         * @param ImageUtil $image The MapUtil instance
         * @param SluggerUtil $slugger The SluggerUtil instance
         * @param string $cache The cache path
-        * @param string $public The public path
+        * @param string $path The public path
+        * @param string $prefix The prefix
         */
         */
-       function __construct(ContainerInterface $container, ImageUtil $image, SluggerUtil $slugger, string $cache = '../var/cache/image', string $public = './bundles/rapsyspack/image') {
+       function __construct(ContainerInterface $container, ImageUtil $image, SluggerUtil $slugger, string $cache = '../var/cache', string $path = './bundles/rapsyspack', string $prefix = 'image') {
                //Set cache
                //Set cache
-               $this->cache = $cache;
+               $this->cache = $cache.'/'.$prefix;
 
                //Set container
                $this->container = $container;
 
                //Set container
                $this->container = $container;
@@ -76,8 +70,8 @@ class ImageController extends AbstractController implements ServiceSubscriberInt
                //Set image
                $this->image = $image;
 
                //Set image
                $this->image = $image;
 
-               //Set public
-               $this->public = $public;
+               //Set path
+               $this->path = $path.'/'.$prefix;
 
                //Set slugger
                $this->slugger = $slugger;
 
                //Set slugger
                $this->slugger = $slugger;
@@ -105,7 +99,7 @@ class ImageController extends AbstractController implements ServiceSubscriberInt
                $hashed = array_reverse(str_split(strval($updated)));
 
                //Set captcha
                $hashed = array_reverse(str_split(strval($updated)));
 
                //Set captcha
-               $captcha = $this->public.'/'.$hashed[0].'/'.$hashed[1].'/'.$hashed[2].'/'.$updated.'/'.$equation.'/'.$width.'x'.$height.'.jpeg';
+               $captcha = $this->path.'/'.$hashed[0].'/'.$hashed[1].'/'.$hashed[2].'/'.$updated.'/'.$equation.'/'.$width.'x'.$height.'.jpeg';
 
                //Unshort equation
                $equation = $this->slugger->unshort($equation);
 
                //Unshort equation
                $equation = $this->slugger->unshort($equation);
@@ -157,7 +151,7 @@ class ImageController extends AbstractController implements ServiceSubscriberInt
                        $draw->setFontSize($this->image->captchaFontSize/1.5);
 
                        //Set stroke width
                        $draw->setFontSize($this->image->captchaFontSize/1.5);
 
                        //Set stroke width
-                       $draw->setStrokeWidth($this->image->captchaStrokeWidth / 2);
+                       $draw->setStrokeWidth($this->image->captchaStrokeWidth / 3);
 
                        //Set rotation
                        $draw->rotate($rotate = (rand(25, 75)*(rand(0,1)?-.1:.1)));
 
                        //Set rotation
                        $draw->rotate($rotate = (rand(25, 75)*(rand(0,1)?-.1:.1)));
@@ -256,7 +250,7 @@ class ImageController extends AbstractController implements ServiceSubscriberInt
                $hashed = array_reverse(str_split(strval($updated)));
 
                //Set thumb
                $hashed = array_reverse(str_split(strval($updated)));
 
                //Set thumb
-               $thumb = $this->public.'/'.$hashed[0].'/'.$hashed[1].'/'.$hashed[2].'/'.$updated.'/'.$path.'/'.$width.'x'.$height.'.jpeg';
+               $thumb = $this->path.'/'.$hashed[0].'/'.$hashed[1].'/'.$hashed[2].'/'.$updated.'/'.$path.'/'.$width.'x'.$height.'.jpeg';
 
                //Unshort path
                $path = $this->slugger->unshort($path);
 
                //Unshort path
                $path = $this->slugger->unshort($path);