I tried use imagick class in laravel 8 and paste multi images but after one photo the others get blur and soft. i think filter problem but i could not find the correct way to fix. How can i solve this problem?
use Imagine\Image\Box;
use Imagine\Image\Palette\RGB;
use Imagine\Image\Point;
use Imagine\Image\Point\Center;
use Imagine\Imagick\Imagine;
use Imagick;
const COLLAGE_W = 1181;
const COLLAGE_H = 1772;
const IMAGE_W = 590;
const IMAGE_H = 709;
const IMAGE_1_Y = 90;
const IMAGE_2_Y = 889;
const FORMAT = 'jpeg';
public function IkiliPhoto(){
$path = "upload/okul/gecici_dosya/";
$images=[];
$yazi = [];
$fotograf = Fotograf::where("okul_id", session()->get('session_sinif_id'))->get();
foreach($fotograf as $foto){
$images[] = $foto["resim"];
$yazi[] = $foto["ogrenci"]["isim"]. " ". $foto["ogrenci"]["soyisim"];
}
$imagine = new Imagine;
foreach (array_chunk($images, 2, true) as $imageRow) {
foreach ($imageRow as $key => $image_path) {
$collageBox = new Box(self::COLLAGE_W, self::COLLAGE_H);
$collageCenter = new Center($collageBox);
$collage = $imagine->create($collageBox);
$palette = new RGB();
$font = $imagine->font(public_path('/fonts/tahoma.ttf'), 30, $palette->color('#000'));
$y = self::IMAGE_1_Y;
$image = new Imagick($image_path);
$photo = $imagine->load($image->getImageBlob());
$photo->resize(new Box(self::IMAGE_W, self::IMAGE_H));
$collage->paste($photo, new Point(0, $y));
$collage->paste($photo, new Point($collageCenter->getX(), $y));
$collage->save($path ."/". $key.'.jpg');
$y = self::IMAGE_2_Y;
}
}
}
i just want get clear photos by paste. Regards.