@@ -61,23 +61,24 @@ public function create($category, $path)
61
61
//new image name created with class BaseName
62
62
$ imageName = $ this ->name ->getName (FileHelper::getFileName ($ path ));
63
63
DirectoryHelper::create ($ newPath , true );
64
- //TODO:make size creator
65
- $ image = '' ;
66
64
65
+ $ image = '' ;
66
+ //TODO:refactor here!
67
67
foreach ($ categoriesParam ['category ' ] as $ category ) {
68
68
if (isset ($ category ['origin ' ]) && $ category ['origin ' ]) {
69
69
$ image = $ imageName . "-origin. " . FileHelper::getFileType ($ path );
70
70
copy ($ path , implode (DIRECTORY_SEPARATOR , [$ newPath , $ image ]));
71
+
71
72
} elseif (isset ($ categoriesParam ['origin ' ]) && $ categoriesParam ['origin ' ]) {
72
73
$ image = $ imageName . "-origin. " . FileHelper::getFileType ($ path );
73
74
copy ($ path , implode (DIRECTORY_SEPARATOR , [$ newPath , $ image ]));
74
75
}
76
+
75
77
$ arr = isset ($ category ['size ' ]) ? array_merge ($ defaultCategoriesSize , $ category ['size ' ]) : $ defaultCategoriesSize ;
76
78
foreach ($ arr as $ sizeName => $ size ) {
77
79
$ image = $ imageName . "- $ sizeName. " . FileHelper::getFileType ($ path );
78
80
$ this ->imageCreator ->thumbnail ($ path , $ size ['width ' ], $ size ['height ' ]);
79
81
$ this ->imageCreator ->save (implode (DIRECTORY_SEPARATOR , [$ newPath , $ image ]));
80
- // copy($path, implode(DIRECTORY_SEPARATOR, [$newPath, $image]));
81
82
}
82
83
}
83
84
0 commit comments