|
@@ 615-632 (lines=18) @@
|
| 612 |
|
|
| 613 |
|
## -------------------------------------------------------- |
| 614 |
|
|
| 615 |
|
private function getSizeByFixedHeight($newWidth, $newHeight) |
| 616 |
|
{ |
| 617 |
|
// *** If forcing is off... |
| 618 |
|
if (!$this->forceStretch) { |
| 619 |
|
|
| 620 |
|
// *** ...check if actual height is less than target height |
| 621 |
|
if ($this->height < $newHeight) { |
| 622 |
|
return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height); |
| 623 |
|
} |
| 624 |
|
} |
| 625 |
|
|
| 626 |
|
$ratio = $this->width / $this->height; |
| 627 |
|
|
| 628 |
|
$newWidth = $newHeight * $ratio; |
| 629 |
|
|
| 630 |
|
//return $newWidth; |
| 631 |
|
return array('optimalWidth' => $newWidth, 'optimalHeight' => $newHeight); |
| 632 |
|
} |
| 633 |
|
|
| 634 |
|
## -------------------------------------------------------- |
| 635 |
|
|
|
@@ 636-653 (lines=18) @@
|
| 633 |
|
|
| 634 |
|
## -------------------------------------------------------- |
| 635 |
|
|
| 636 |
|
private function getSizeByFixedWidth($newWidth, $newHeight) |
| 637 |
|
{ |
| 638 |
|
// *** If forcing is off... |
| 639 |
|
if (!$this->forceStretch) { |
| 640 |
|
|
| 641 |
|
// *** ...check if actual width is less than target width |
| 642 |
|
if ($this->width < $newWidth) { |
| 643 |
|
return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height); |
| 644 |
|
} |
| 645 |
|
} |
| 646 |
|
|
| 647 |
|
$ratio = $this->height / $this->width; |
| 648 |
|
|
| 649 |
|
$newHeight = $newWidth * $ratio; |
| 650 |
|
|
| 651 |
|
//return $newHeight; |
| 652 |
|
return array('optimalWidth' => $newWidth, 'optimalHeight' => $newHeight); |
| 653 |
|
} |
| 654 |
|
|
| 655 |
|
## -------------------------------------------------------- |
| 656 |
|
|