Update: laravel 8 to 12, php 7.3 to php 8.3, Jenkinsfile, Unit/Feature testing, vapor, docker

This commit is contained in:
Dillon Ngo
2026-04-03 06:59:39 +08:00
parent 58de1017d7
commit b34b7c19d6
142 changed files with 3334 additions and 1101 deletions
@@ -7,6 +7,7 @@ use App\Classes\General\Interfaces\DataTransferObject;
use App\Classes\ValueObjects\Constants\FileType;
use Illuminate\Support\Str;
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;
class FileObject implements DataTransferObject
{
@@ -28,7 +29,13 @@ class FileObject implements DataTransferObject
*/
public function getData()
{
return in_array($this->getExtension(), ['pdf', 'excel', 'text']) ? $this->data : (new imageManager())->make($this->data);
// intervention/image v2: old
//return in_array($this->getExtension(), ['pdf', 'excel', 'text']) ? $this->data : (new imageManager())->make($this->data);
// intervention/image v3: new
return in_array($this->getExtension(), ['pdf', 'excel', 'text'])
? $this->data
: (new ImageManager(new Driver()))->read($this->data);
}
/**
@@ -53,7 +60,7 @@ class FileObject implements DataTransferObject
*/
public function getExtension(): string
{
if(array_key_exists($this->getMimeType(), FileType::EXTENSION)){
if (array_key_exists($this->getMimeType(), FileType::EXTENSION)) {
return FileType::EXTENSION[$this->getMimeType()];
}
@@ -66,9 +73,10 @@ class FileObject implements DataTransferObject
*/
public function getDecodedData(): string
{
// intervention/image v3: Use encode()->toDataUri() instead of encode('data-url')->encoded
return in_array($this->getExtension(), ['pdf', 'excel', 'text']) ?
base64_decode((explode('base64,', $this->getData()))[1]):
$this->getData()->encode('data-url')->encoded;
base64_decode((explode('base64,', $this->getData()))[1]) :
$this->getData()->encode()->toDataUri();
}
/**