| @@ 91-97 (lines=7) @@ | ||
| 88 | //the user wants to resize based on constant height |
|
| 89 | $w = round( $h * $src_ratio ); |
|
| 90 | } |
|
| 91 | if ( !$crop ) { |
|
| 92 | return array( |
|
| 93 | 'x' => 0, 'y' => 0, |
|
| 94 | 'src_w' => $src_w, 'src_h' => $src_h, |
|
| 95 | 'target_w' => $w, 'target_h' => $h |
|
| 96 | ); |
|
| 97 | } |
|
| 98 | // Get ratios |
|
| 99 | $dest_ratio = $w / $h; |
|
| 100 | $src_wt = $src_h * $dest_ratio; |
|
| @@ 119-125 (lines=7) @@ | ||
| 116 | $src_x = $src_w - $src_wt; |
|
| 117 | } |
|
| 118 | // Crop the image |
|
| 119 | if ( $dest_ratio > $src_ratio ) { |
|
| 120 | return array( |
|
| 121 | 'x' => 0, 'y' => $src_y, |
|
| 122 | 'src_w' => $src_w, 'src_h' => $src_ht, |
|
| 123 | 'target_w' => $w, 'target_h' => $h |
|
| 124 | ); |
|
| 125 | } |
|
| 126 | return array( |
|
| 127 | 'x' => $src_x, 'y' => 0, |
|
| 128 | 'src_w' => $src_wt, 'src_h' => $src_h, |
|