I have a problem with imagecopyresampled
. So, I crop a picture (jpg), want to add white background, for the output picture ... and it doesn't work ...
Here is my code:
$this->imageResized = imagecreatetruecolor($sizes['width'], $sizes['height']);
$white = imagecolorallocate($this->imageResized, 255, 255, 255);
imagefill($this->imageResized, 0, 0, $white);
imagecopyresampled($this->imageResized, $this->image, 0, 0, (($selected_x * $ratio) - ($blanc_x * $ratio)), (($selected_y * $ratio) - ($blanc_y * $ratio)), $sizes['width'], $sizes['height'], ($selected_width * $ratio), ($selected_height * $ratio));
imagejpeg($this->imageResized, $savePath, $imageQuality);
So, it work, but, the background is black, and not white ...
Here is the output picture ...
EDIT:
Passed values are (0, 0, 31, -50, 110, 110, 110, 110);
And, if I fill after the imagecopyresampled, it works just sometimes, cause, it adds me domes black borders ...
Any ideas? ...