mirror of
https://github.com/mosbth/cimage.git
synced 2025-03-14 14:09:40 +01:00
prepare to tag v0.7.12
This commit is contained in:
parent
9e9c44c935
commit
5edbfc9b54
@ -8,7 +8,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
$version = "v0.7.11 (2016-04-18)";
|
||||
$version = "v0.7.12 (2016-05-31)";
|
||||
|
||||
// For CRemoteImage
|
||||
define("CIMAGE_USER_AGENT", "CImage/$version");
|
||||
|
@ -23,7 +23,7 @@ return array(
|
||||
* mode: 'production'
|
||||
*/
|
||||
//'mode' => 'production',
|
||||
'mode' => 'development',
|
||||
//'mode' => 'development',
|
||||
//'mode' => 'strict',
|
||||
|
||||
|
||||
|
@ -2022,7 +2022,13 @@ class CImage
|
||||
$this->newWidth = round($factor * $width);
|
||||
$this->log("New height was set.");
|
||||
|
||||
} else {
|
||||
|
||||
// Use existing width and height as new width and height.
|
||||
$this->newWidth = $width;
|
||||
$this->newHeight = $height;
|
||||
}
|
||||
|
||||
|
||||
// Get image dimensions for pre-resize image.
|
||||
if ($this->cropToFit || $this->fillToFit) {
|
||||
@ -2620,25 +2626,45 @@ class CImage
|
||||
// Resize by crop to fit
|
||||
$this->log("Resizing using strategy - Crop to fit");
|
||||
|
||||
if (!$this->upscale && ($this->width < $this->newWidth || $this->height < $this->newHeight)) {
|
||||
if (!$this->upscale
|
||||
&& ($this->width < $this->newWidth || $this->height < $this->newHeight)) {
|
||||
$this->log("Resizing - smaller image, do not upscale.");
|
||||
|
||||
$cropX = round(($this->cropWidth/2) - ($this->newWidth/2));
|
||||
$cropY = round(($this->cropHeight/2) - ($this->newHeight/2));
|
||||
//$cropX = round(($this->cropWidth/2) - ($this->width/2));
|
||||
//$cropY = round(($this->cropHeight/2) - ($this->height/2));
|
||||
|
||||
$posX = 0;
|
||||
$posY = 0;
|
||||
$cropX = 0;
|
||||
$cropY = 0;
|
||||
|
||||
if ($this->newWidth > $this->width) {
|
||||
$posX = round(($this->newWidth - $this->width) / 2);
|
||||
}
|
||||
if ($this->newWidth < $this->width) {
|
||||
$cropX = round(($this->width/2) - ($this->newWidth/2));
|
||||
}
|
||||
|
||||
if ($this->newHeight > $this->height) {
|
||||
$posY = round(($this->newHeight - $this->height) / 2);
|
||||
}
|
||||
if ($this->newHeight < $this->height) {
|
||||
$cropY = round(($this->height/2) - ($this->newHeight/2));
|
||||
}
|
||||
$this->log(" cwidth: $this->cropWidth");
|
||||
$this->log(" cheight: $this->cropHeight");
|
||||
$this->log(" nwidth: $this->newWidth");
|
||||
$this->log(" nheight: $this->newHeight");
|
||||
$this->log(" width: $this->width");
|
||||
$this->log(" height: $this->height");
|
||||
$this->log(" posX: $posX");
|
||||
$this->log(" posY: $posY");
|
||||
$this->log(" cropX: $cropX");
|
||||
$this->log(" cropY: $cropY");
|
||||
|
||||
$imageResized = $this->CreateImageKeepTransparency($this->newWidth, $this->newHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, $cropX, $cropY, $this->newWidth, $this->newHeight);
|
||||
//imagecopy($imageResized, $this->image, $posX, $posY, 0, 0, $this->width, $this->height);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, $cropX, $cropY, $this->width, $this->height);
|
||||
} else {
|
||||
$cropX = round(($this->cropWidth/2) - ($this->newWidth/2));
|
||||
$cropY = round(($this->cropHeight/2) - ($this->newHeight/2));
|
||||
@ -2671,14 +2697,14 @@ class CImage
|
||||
}
|
||||
|
||||
if (!$this->upscale
|
||||
&& ($this->width < $this->newWidth || $this->height < $this->newHeight)
|
||||
&& ($this->width < $this->newWidth && $this->height < $this->newHeight)
|
||||
) {
|
||||
|
||||
$this->log("Resizing - smaller image, do not upscale.");
|
||||
$posX = round(($this->fillWidth - $this->width) / 2);
|
||||
$posY = round(($this->fillHeight - $this->height) / 2);
|
||||
$posX = round(($this->newWidth - $this->width) / 2);
|
||||
$posY = round(($this->newHeight - $this->height) / 2);
|
||||
$imageResized = $this->CreateImageKeepTransparency($this->newWidth, $this->newHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, 0, 0, $this->fillWidth, $this->fillHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, 0, 0, $this->width, $this->height);
|
||||
|
||||
} else {
|
||||
$imgPreFill = $this->CreateImageKeepTransparency($this->fillWidth, $this->fillHeight);
|
||||
@ -2722,7 +2748,7 @@ class CImage
|
||||
|
||||
//$this->log("posX=$posX, posY=$posY, cropX=$cropX, cropY=$cropY.");
|
||||
$imageResized = $this->CreateImageKeepTransparency($this->newWidth, $this->newHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, $cropX, $cropY, $this->newWidth, $this->newHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, $cropX, $cropY, $this->width, $this->height);
|
||||
$this->image = $imageResized;
|
||||
$this->width = $this->newWidth;
|
||||
$this->height = $this->newHeight;
|
||||
|
@ -2022,7 +2022,13 @@ class CImage
|
||||
$this->newWidth = round($factor * $width);
|
||||
$this->log("New height was set.");
|
||||
|
||||
} else {
|
||||
|
||||
// Use existing width and height as new width and height.
|
||||
$this->newWidth = $width;
|
||||
$this->newHeight = $height;
|
||||
}
|
||||
|
||||
|
||||
// Get image dimensions for pre-resize image.
|
||||
if ($this->cropToFit || $this->fillToFit) {
|
||||
@ -2620,25 +2626,45 @@ class CImage
|
||||
// Resize by crop to fit
|
||||
$this->log("Resizing using strategy - Crop to fit");
|
||||
|
||||
if (!$this->upscale && ($this->width < $this->newWidth || $this->height < $this->newHeight)) {
|
||||
if (!$this->upscale
|
||||
&& ($this->width < $this->newWidth || $this->height < $this->newHeight)) {
|
||||
$this->log("Resizing - smaller image, do not upscale.");
|
||||
|
||||
$cropX = round(($this->cropWidth/2) - ($this->newWidth/2));
|
||||
$cropY = round(($this->cropHeight/2) - ($this->newHeight/2));
|
||||
//$cropX = round(($this->cropWidth/2) - ($this->width/2));
|
||||
//$cropY = round(($this->cropHeight/2) - ($this->height/2));
|
||||
|
||||
$posX = 0;
|
||||
$posY = 0;
|
||||
$cropX = 0;
|
||||
$cropY = 0;
|
||||
|
||||
if ($this->newWidth > $this->width) {
|
||||
$posX = round(($this->newWidth - $this->width) / 2);
|
||||
}
|
||||
if ($this->newWidth < $this->width) {
|
||||
$cropX = round(($this->width/2) - ($this->newWidth/2));
|
||||
}
|
||||
|
||||
if ($this->newHeight > $this->height) {
|
||||
$posY = round(($this->newHeight - $this->height) / 2);
|
||||
}
|
||||
if ($this->newHeight < $this->height) {
|
||||
$cropY = round(($this->height/2) - ($this->newHeight/2));
|
||||
}
|
||||
$this->log(" cwidth: $this->cropWidth");
|
||||
$this->log(" cheight: $this->cropHeight");
|
||||
$this->log(" nwidth: $this->newWidth");
|
||||
$this->log(" nheight: $this->newHeight");
|
||||
$this->log(" width: $this->width");
|
||||
$this->log(" height: $this->height");
|
||||
$this->log(" posX: $posX");
|
||||
$this->log(" posY: $posY");
|
||||
$this->log(" cropX: $cropX");
|
||||
$this->log(" cropY: $cropY");
|
||||
|
||||
$imageResized = $this->CreateImageKeepTransparency($this->newWidth, $this->newHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, $cropX, $cropY, $this->newWidth, $this->newHeight);
|
||||
//imagecopy($imageResized, $this->image, $posX, $posY, 0, 0, $this->width, $this->height);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, $cropX, $cropY, $this->width, $this->height);
|
||||
} else {
|
||||
$cropX = round(($this->cropWidth/2) - ($this->newWidth/2));
|
||||
$cropY = round(($this->cropHeight/2) - ($this->newHeight/2));
|
||||
@ -2671,14 +2697,14 @@ class CImage
|
||||
}
|
||||
|
||||
if (!$this->upscale
|
||||
&& ($this->width < $this->newWidth || $this->height < $this->newHeight)
|
||||
&& ($this->width < $this->newWidth && $this->height < $this->newHeight)
|
||||
) {
|
||||
|
||||
$this->log("Resizing - smaller image, do not upscale.");
|
||||
$posX = round(($this->fillWidth - $this->width) / 2);
|
||||
$posY = round(($this->fillHeight - $this->height) / 2);
|
||||
$posX = round(($this->newWidth - $this->width) / 2);
|
||||
$posY = round(($this->newHeight - $this->height) / 2);
|
||||
$imageResized = $this->CreateImageKeepTransparency($this->newWidth, $this->newHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, 0, 0, $this->fillWidth, $this->fillHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, 0, 0, $this->width, $this->height);
|
||||
|
||||
} else {
|
||||
$imgPreFill = $this->CreateImageKeepTransparency($this->fillWidth, $this->fillHeight);
|
||||
@ -2722,7 +2748,7 @@ class CImage
|
||||
|
||||
//$this->log("posX=$posX, posY=$posY, cropX=$cropX, cropY=$cropY.");
|
||||
$imageResized = $this->CreateImageKeepTransparency($this->newWidth, $this->newHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, $cropX, $cropY, $this->newWidth, $this->newHeight);
|
||||
imagecopy($imageResized, $this->image, $posX, $posY, $cropX, $cropY, $this->width, $this->height);
|
||||
$this->image = $imageResized;
|
||||
$this->width = $this->newWidth;
|
||||
$this->height = $this->newHeight;
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user