- $explodedPath = explode('/', $image->url);
- array_splice($explodedPath, 4, 0, ['thumbs-' . $width . '-' . $height]);
- $thumbPath = implode('/', $explodedPath);
- $thumbFilePath = public_path() . $thumbPath;
-
- // Return the thumbnail url path if already exists
- if (file_exists($thumbFilePath)) {
- return $thumbPath;
- }
-
- // Otherwise create the thumbnail
- $thumb = ImageTool::make(public_path() . $image->url);
- $thumb->fit($width, $height);
-
- // Create thumbnail folder if it does not exist
- if (!file_exists(dirname($thumbFilePath))) {
- mkdir(dirname($thumbFilePath), 0775, true);
- }
-
- //Save Thumbnail
- $thumb->save($thumbFilePath);
- return $thumbPath;
+ $imgData = $this->imageRepo->getPaginatedByType('user', $page, 24, $this->currentUser->id);
+ return response()->json($imgData);