Page 1 of 1
PHP and Convert()
Posted: 2013-05-29T17:58:05-07:00
by Galaxy_Stranger
I'm writing a web-app in PHP that will take an image and stitch it together with another image to create a third image with both originals appearing side-by-side.
As I understand it, Imagemagick's Convert() provides the functionality I need. I've been going through PHPs Imagmagick functionality, but I'm having trouble finding a "convert" method or anything that would work.
What is the preferred method of performing this using PHP?
Re: PHP and Convert()
Posted: 2013-05-29T19:04:09-07:00
by fmw42
Imagick is not well supported and uses different syntax than Imagemagick. I would suggest you just use PHP exec() and run Imagemagick normal command line syntax with convert.
Re: PHP and Convert()
Posted: 2013-05-30T01:22:51-07:00
by Bonzo
I have a lot of Imagemagick and a few Imagick examples on my
website
As fmw42 said I would go with the exec() method rather than Imagick although your code should be quite simple.
Code: Select all
<?php
$cmd = "input1.jpg input2.jpg +append";
exec("convert $cmd append_horiz.jpg");
?>
Code: Select all
<?php
$im = new Imagick();
$im->readImage('input1.jpg');
$im->readImage('input1.jpg');
$im->resetIterator();
$appended = $im->appendImages(FALSE);
$appended->writeImage('appendImages.jpg');
$appended->destroy();
?>
Re: PHP and Convert()
Posted: 2013-05-30T10:03:10-07:00
by Galaxy_Stranger
Well, if that's what I have to do I'll go for it.
It just seemed odd that there wasn't a built-in way of going about it.
Thanks!
Re: PHP and Convert()
Posted: 2013-05-30T13:14:15-07:00
by Bonzo
Imagemagick is an external program that is not built into php so you can not just use convert. Although I believe version 7 may be built into future versions of php.