2

is it possible to fit image onto a white background image using wideimage and in that way to show the image without deformations?.

Now I have this, this source merges a background image with an uploaded image, but a part of image loses

public function createThumb($pathimg, $img, $id) {
$paththumb = 'img/upload/thumbs/' . $img;
$imagen = WideImage::load($pathimg);
$width = $imagen->getWidth();
$height = $imagen->getHeight();
$newWidth = 427;
$newHeight = ($newWidth / $width) * $height;

    $imagen->resize($newWidth, $newHeight, 'fill')->saveToFile($paththumb);

    $img1 = WideImage::load(realpath($paththumb));
    $watermark = WideImage::load(realpath('img/bg.jpg'));
    $new = $img1->merge($watermark, 0, 0, 20);
    $new->saveToFile($paththumb);
}
Tetsujin no Oni
  • 7,300
  • 2
  • 29
  • 46
Alexander Ceballos
  • 750
  • 2
  • 20
  • 36

0 Answers0