문제

An Image should be stored in a specific format and the remaining space should be filled black. My problem is, that the picture is'nt shown in an html page, it should just be converted and stored in the described way. Is there any simple sollution with PHP?

도움이 되었습니까?

해결책

You could use Imagick. Imagick is a native php extension to create and modify images. It has a specific function for that called Imagick::borderImage.

Something like this could do the job:

$image = new Imagick('your_image.jpg');
$color=new ImagickPixel();
$color->setColor("rgb(100,200,50)");
$image->borderImage($color,1,1);
$image->writeImage('your_bordered_image.jpg');

You might have to adjust those code lines slightly, I just have thrown them together.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top