문제

I need to create an image with Imagick php with white background of a certain size (45 cm wide x 32 cm high) and copy him within an image that I have in a folder in a certain fixed position.

I could help with this?

A greeting and thank you very much

도움이 되었습니까?

해결책

imagecopy is the function you need

crop image example:

<?php
// Create image instances
$src = imagecreatefromgif('php.gif');
$dest = imagecreatetruecolor(80, 40);

// Copy
imagecopy($dest, $src, 0, 0, 20, 13, 80, 40);

// Output and free from memory
header('Content-Type: image/gif');
imagegif($dest);

imagedestroy($dest);
imagedestroy($src);
?>

if you just need to add a white background imagefill is your function:

$image = imagecreatetruecolor(100, 100);

// set background to white
$white = imagecolorallocate($im, 255, 255, 255);
imagefill($image, 0, 0, $white);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top