Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top