forked from codebuds33/webp-conversion-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc7a234
commit 49edf01
Showing
4 changed files
with
97 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace CodeBuds\WebPConversionBundle\Model; | ||
|
||
|
||
use CodeBuds\WebPConversionBundle\Traits\ConvertibleImageTrait; | ||
use Exception; | ||
use Symfony\Component\HttpFoundation\File\File; | ||
|
||
class WebPInformation | ||
{ | ||
private int $quality; | ||
|
||
private string $filename; | ||
|
||
private string $path; | ||
|
||
private string $filenameSuffix; | ||
|
||
private bool $saved = false; | ||
|
||
/** | ||
* @param array $information | ||
* @return $this | ||
*/ | ||
public function __construct(array $information) | ||
{ | ||
$this->path = $information["options"]["savePath"]; | ||
$this->quality = $information["options"]["quality"]; | ||
$this->filename = $information["options"]["filename"]; | ||
$this->filenameSuffix = $information["options"]["filenameSuffix"]; | ||
$this->saved = $information["options"]["saveFile"]; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getQuality(): int | ||
{ | ||
return $this->quality; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getFilename(): string | ||
{ | ||
return $this->filename; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPath(): string | ||
{ | ||
return $this->path; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getFilenameSuffix(): string | ||
{ | ||
return $this->filenameSuffix; | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function isSaved(): bool | ||
{ | ||
return $this->saved; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getConvertedFullPath(): string | ||
{ | ||
return "{$this->path}/{$this->filename}{$this->filenameSuffix}.webp"; | ||
} | ||
|
||
} |
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