Created
February 10, 2010 21:28
-
-
Save westonruter/300864 to your computer and use it in GitHub Desktop.
A patch to fix a “Scale to Fit” issue in the Shopp WordPress plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: core/model/Image.php | |
=================================================================== | |
--- core/model/Image.php (revision 99) | |
+++ core/model/Image.php (revision 100) | |
@@ -72,16 +72,14 @@ | |
if($this->src->height*$scale > $height){ // Now scale by height if it would end up too tall | |
$scale *= $height / ($this->src->height*$scale); | |
} | |
- $this->Processed->width = $width; | |
- $this->Processed->height = ceil($this->src->height * $scale); | |
} else { // Scale to height | |
$scale = $height / $this->src->height; | |
if($this->src->width*$scale > $width){ // Now scale by width if it would end up too wide | |
$scale *= $width / ($this->src->width*$scale); | |
} | |
- $this->Processed->height = ceil($this->src->height * $scale); | |
- $this->Processed->width = ceil($this->src->width * $scale); | |
} | |
+ $this->Processed->height = ceil($this->src->height * $scale); | |
+ $this->Processed->width = ceil($this->src->width * $scale); | |
$this->Processed->image = ImageCreateTrueColor($this->Processed->width,$this->Processed->height); | |
ImageCopyResampled($this->Processed->image, $this->src->image, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment