slight adjustment to Photo scaling - also discovered imagick resize may need some additional work
This commit is contained in:
parent
0693afd6b7
commit
8416cff2a5
1 changed files with 11 additions and 3 deletions
|
@ -213,8 +213,16 @@ class Photo {
|
||||||
// Don't forget to go back to the first frame
|
// Don't forget to go back to the first frame
|
||||||
$this->image->setFirstIterator();
|
$this->image->setFirstIterator();
|
||||||
do {
|
do {
|
||||||
|
|
||||||
|
// FIXME - implement horizantal bias for scaling as in followin GD functions
|
||||||
|
// to allow very tall images to be constrained only horizontally.
|
||||||
|
|
||||||
$this->image->resizeImage($max, $max, imagick::FILTER_LANCZOS, 1, true);
|
$this->image->resizeImage($max, $max, imagick::FILTER_LANCZOS, 1, true);
|
||||||
} while ($this->image->nextImage());
|
} while ($this->image->nextImage());
|
||||||
|
|
||||||
|
// FIXME - also we need to copy the new dimensions to $this->height, $this->width as other functions
|
||||||
|
// may rely on it.
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,11 +264,11 @@ class Photo {
|
||||||
if( $height > $max ) {
|
if( $height > $max ) {
|
||||||
|
|
||||||
// very tall image (greater than 16:9)
|
// very tall image (greater than 16:9)
|
||||||
// constrain the width - let the height float.
|
// but width is OK - don't do anything
|
||||||
|
|
||||||
if((($height * 9) / 16) > $width) {
|
if((($height * 9) / 16) > $width) {
|
||||||
$dest_width = $max;
|
$dest_width = $width;
|
||||||
$dest_height = intval(( $height * $max ) / $width);
|
$dest_height = $height;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$dest_width = intval(( $width * $max ) / $height);
|
$dest_width = intval(( $width * $max ) / $height);
|
||||||
|
|
Loading…
Reference in a new issue