@@ -42,9 +42,10 @@ public function __construct($files = null, $path = null, $disablePermissionCheck
4242    /** 
4343     * @param Repository $config 
4444     * @param Image $image 
45+      * @param Filesystem $filesystem 
4546     * @return CommandResult 
4647     */ 
47-     public  function  handle (Repository $ configImage $ image
48+     public  function  handle (Repository $ configImage $ image, Filesystem   $ filesystem 
4849    {
4950        // check if user has permission 
5051        if ( ! $ this disablePermissionChecking  )
@@ -65,11 +66,11 @@ public function handle(Repository $config,Image $image)
6566
6667            // save the file 
6768            $ filemove (
68-                 $ config -> get ( ' filesystems.disks.local.root ' ). ' / ' . $ this normalizePath ( $ path
69+                 $ this getCurrentFullPath ( $ config , $ path
6970                $ normalizedFileName
7071            );
7172
72-             $ filePath$ config -> get ( ' filesystems.disks.local.root ' ). ' / ' . $ this normalizePath ( $ path. ' / ' $ normalizedFileName
73+             $ filePath$ this getCurrentFullPath ( $ config , $ path$ normalizedFileName
7374            $ file_namepathinfo ($ filePathPATHINFO_FILENAME );
7475            $ extensionpathinfo ($ filePathPATHINFO_EXTENSION );
7576
@@ -80,11 +81,18 @@ public function handle(Repository $config,Image $image)
8081            {
8182                foreach ($ sizesas  $ key$ dimension
8283                {
84+                     $ targetDir$ this getCurrentFullPath ($ config$ path$ keyDIRECTORY_SEPARATOR ;
85+ 
86+                     if ( ! $ filesystemexists ($ targetDir
87+                     {
88+                         $ filesystemmakeDirectory ($ this normalizePath ($ pathDIRECTORY_SEPARATOR .$ keyDIRECTORY_SEPARATOR );
89+                     }
90+ 
8391                    $ imagecreateThumbnail (
8492                        $ filePath
8593                        $ dimension0 ],
8694                        $ dimension1 ],
87-                         $ config -> get ( ' filesystems.disks.local.root ' ). ' / ' . $ this -> normalizePath ( $ path ). ' / ' . $ this -> produceThumbFileName ( $ file_name , $ key , $ extension) 
95+                         $ targetDir . $ file_name . ' . ' . $ extension
8896                    );
8997                }
9098            }
@@ -121,6 +129,16 @@ protected function produceThumbFileName($file_name, $file_size_name, $file_exten
121129        return  $ file_name'_ ' .$ file_size_name'. ' .$ file_extension
122130    }
123131
132+     /** 
133+      * @param Repository $config 
134+      * @param string $path 
135+      * @return string 
136+      */ 
137+     protected  function  getCurrentFullPath ($ config$ path
138+     {
139+         return  $ configget ('filesystems.disks.local.root ' ).DIRECTORY_SEPARATOR .$ this normalizePath ($ pathDIRECTORY_SEPARATOR ;
140+     }
141+ 
124142    /** 
125143     * when uploading a file, we will remove dashes because dashes are use in UI as size convention 
126144     * 
0 commit comments