Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($width < $originalWidth && $height < $originalHeight) {
- $aspectRatio = $width / $height;
- $aspectRatioIncoming = $originalWidth / $originalHeight;
- if ($aspectRatioIncoming > 1) {
- $heightCrop = $originalWidth / $aspectRatio;
- $widthCrop = $heightCrop * $aspectRatio;
- } else {
- $widthCrop = $originalHeight * $aspectRatio;
- $heightCrop = $widthCrop / $aspectRatio;
- }
- $image->crop(floor($widthCrop), floor($heightCrop));
- $resizeWidth = $this->retinaSize($width);
- $resizeHeight = $this->retinaSize($height);
- $image->resize(floor($resizeWidth), floor($resizeHeight));
- }
Add Comment
Please, Sign In to add comment