Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function validate($canSetHdSkin)
- {
- $height = $this->image->getHeight();
- $width = $this->image->getWidth();
- $ratio = $width / 128;
- $validHeight = $height / $ratio === 64;
- $validWidth = $width / $ratio === 128;
- if ($canSetHdSkin) {
- if ($validHeight && $validWidth && $width <= 1024 && $height <= 512) {
- return true;
- } else {
- throw new InvalidImageSizeException();
- }
- } else {
- if ($validHeight && $validWidth) {
- if ($height === 64 && $width === 128) {
- return true;
- } else {
- throw new InvalidImageSizeException();
- }
- } else {
- throw new InvalidImageSizeException();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement