-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When uploading profile picture 3 different sized are created (#17)
- full size is used for Character Profile view - small size used for Messages
- Loading branch information
Showing
12 changed files
with
177 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace App\Services\FilesystemService; | ||
|
||
use Illuminate\Support\Collection; | ||
use Intervention\Image\Image; | ||
|
||
class ImageFiles extends Collection | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $folder; | ||
|
||
public function __construct(string $folder, $items = []) | ||
{ | ||
parent::__construct($items); | ||
|
||
$this->folder = $folder; | ||
} | ||
|
||
public function addImageFile($key, Image $image): self | ||
{ | ||
$this->offsetSet($key, $image); | ||
|
||
return $this; | ||
} | ||
|
||
public function getFullSizePath(): string | ||
{ | ||
/** @var Image $image */ | ||
$image = $this->get('full'); | ||
|
||
$path = $image ? $this->folder . $image->basename : ''; | ||
|
||
return $path; | ||
} | ||
|
||
public function getSmallSizePath(): string | ||
{ | ||
/** @var Image $image */ | ||
$image = $this->get('small'); | ||
|
||
$path = $image ? $this->folder . $image->basename : ''; | ||
|
||
return $path; | ||
} | ||
|
||
public function getIconSizePath(): string | ||
{ | ||
/** @var Image $image */ | ||
$image = $this->get('icon'); | ||
|
||
$path = $image ? $this->folder . $image->basename : ''; | ||
|
||
return $path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.