|
@@ 39-43 (lines=5) @@
|
| 36 |
|
$width = $image_size['width']; |
| 37 |
|
$height = $image_size['height']; |
| 38 |
|
if ($width >= $height) { |
| 39 |
|
if ($width >= $max_size_for_picture) { |
| 40 |
|
// scale height |
| 41 |
|
$new_height = round($height * ($max_size_for_picture / $width)); |
| 42 |
|
$this->image_wrapper->resize($max_size_for_picture, $new_height, 0); |
| 43 |
|
} |
| 44 |
|
} else { // height > $width |
| 45 |
|
if ($height >= $max_size_for_picture) { |
| 46 |
|
// scale width |
|
@@ 44-50 (lines=7) @@
|
| 41 |
|
$new_height = round($height * ($max_size_for_picture / $width)); |
| 42 |
|
$this->image_wrapper->resize($max_size_for_picture, $new_height, 0); |
| 43 |
|
} |
| 44 |
|
} else { // height > $width |
| 45 |
|
if ($height >= $max_size_for_picture) { |
| 46 |
|
// scale width |
| 47 |
|
$new_width = round($width * ($max_size_for_picture / $height)); |
| 48 |
|
$this->image_wrapper->resize($new_width, $max_size_for_picture, 0); |
| 49 |
|
} |
| 50 |
|
} |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
public function crop($cropParameters) |