2017-09-01, 20:58:33
(2017-08-27, 19:52:42)Shasaar Wrote: I've set the setting to exact size, landscape orientated.
When uploading a jpg-picture now that is portrait orientated, it gets a black background on both sides.
Try using the 'Variable size' instead.
Select 'Variable size'
Minimum height & width: 0
Maximum height & width: 1000 (or whatever)
Priority: 'Maximum'
It will reduce files larger than the maximum, keeping the aspect ratio, so the canvas is the same size as the picture (so no background to fill).
(2017-08-27, 19:52:42)Shasaar Wrote:PHP Code:public function resize($width,$height) {
$new_image = imagecreatetruecolor($width, $height);
$white = imagecolorallocate($new_image, 255, 255, 255);//added
imagefilledrectangle($new_image, 0, 0, $width, $height, $white); //added
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
imagecopyresampled($new_image, $this->_image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->_image = $new_image;
$this->_height=imagesy($this->_image);
$this->_width=imagesx($this->_image);
} ...
Try using php imagefill instead of imagefilledrectangle? See this Stackoverflow question.
--
Nick.
Nick.