@@ -91,6 +91,7 @@ class Save extends Action implements HttpPostActionInterface
91
91
* @param ImageContentFactory $imageContentFactory
92
92
* @param Database $mediaStorage
93
93
* @param AdapterFactory $imageAdapterFactory
94
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
94
95
*/
95
96
public function __construct (
96
97
Context $ context ,
@@ -254,19 +255,16 @@ private function storePreviewImage(RequestInterface $request) : ?string
254
255
$ decodedImage
255
256
);
256
257
257
- // If the media storage is set to DB also save the file into the DB
258
- if ($ this ->mediaStorage ->checkDbUsage ()) {
259
- $ this ->mediaStorage ->saveFile (
260
- $ filePath
261
- );
262
- }
263
-
264
258
// Generate a thumbnail, called -thumb next to the image for usage in the grid
265
259
$ absolutePath = $ mediaDir ->getAbsolutePath () . $ filePath ;
260
+ $ thumbPath = str_replace ('.jpg ' , '-thumb.jpg ' , $ filePath );
261
+ $ thumbAbsolutePath = $ mediaDir ->getAbsolutePath () . $ thumbPath ;
266
262
$ imageFactory = $ this ->imageAdapterFactory ->create ();
267
263
$ imageFactory ->open ($ absolutePath );
268
264
$ imageFactory ->resize (350 );
269
- $ imageFactory ->save (str_replace ('.jpg ' , '-thumb.jpg ' , $ absolutePath ));
265
+ $ imageFactory ->save ($ thumbAbsolutePath );
266
+ $ this ->mediaStorage ->saveFile ($ filePath );
267
+ $ this ->mediaStorage ->saveFile ($ thumbPath );
270
268
271
269
// Store the preview image within the new entity
272
270
return $ filePath ;
0 commit comments