switch($layout) {
case '2x2':
// make collage
list($width, $height) = getimagesize($collagePhoto[0]);
$my_collage_height = $height * 2;
$my_collage_width = $width * 2;
$my_collage = imagecreatetruecolor($my_collage_width, $my_collage_height)
or die("Kann keinen neuen GD-Bild-Stream erzeugen");
$background = imagecolorallocate($my_collage, 0, 0, 0);
imagecolortransparent($my_collage, $background);
$collage_pic1 = imagecreatefromjpeg($collagePhoto[0]) or die("no imagcreate");
imagecopy($my_collage, $collage_pic1, 0, 0, 0, 0, $width, $height);
$collage_pic2 = imagecreatefromjpeg($collagePhoto[1]) or die("no imagcreate");
imagecopy($my_collage, $collage_pic2, $width, 0, 0, 0, $width, $height);
$collage_pic3 = imagecreatefromjpeg($collagePhoto[2]) or die("no imagcreate");
imagecopy($my_collage, $collage_pic3, 0, $height, 0, 0, $width, $height);
$collage_pic4 = imagecreatefromjpeg($collagePhoto[3]) or die("no imagcreate");
imagecopy($my_collage, $collage_pic4, $width, $height, 0, 0, $width, $height);
break;
case '2x4':
// make collage
$degrees = -90;
list($width, $height) = getimagesize($collagePhoto[0]);
shell_exec(sprintf('convert %s -rotate %s %s',$collagePhoto[0],$degrees,$collagePhoto[0]));
shell_exec(sprintf('convert %s -rotate %s %s',$collagePhoto[1],$degrees,$collagePhoto[1]));
shell_exec(sprintf('convert %s -rotate %s %s',$collagePhoto[2],$degrees,$collagePhoto[2]));
shell_exec(sprintf('convert %s -rotate %s %s',$collagePhoto[3],$degrees,$collagePhoto[3]));
list($width_rotate, $height_rotate) = getimagesize($collagePhoto[0]);
$my_collage_height = $height * 3.3;
$my_collage_width = $width * 3.3;
$height_offset = ((($my_collage_height/2)-$height_rotate)/2);
$width_offset = (($my_collage_width-($width_rotate*4))/5);
$my_collage = imagecreatetruecolor($my_collage_width,$my_collage_height) or die("Kann keinen neuen GD-Bild-Stream erzeugen");
$background = imagecolorallocate($my_collage, 240, 240, 240);
imagefill($my_collage,0,0,$background);
$collage_pic1 = imagecreatefromjpeg($collagePhoto[0]) or die("no imagcreate");
imagecopy( $my_collage, $collage_pic1,$width_offset,$height_offset,0,0,$width_rotate,$height_rotate); // Bild 1 oben
imagecopy( $my_collage, $collage_pic1,$width_offset,($height_rotate+(3*$height_offset)),0,0,$width_rotate,$height_rotate); // Bild 1 unten
$collage_pic2 = imagecreatefromjpeg($collagePhoto[1]) or die("no imagcreate");
imagecopy ( $my_collage, $collage_pic2,($width_offset*2+$width_rotate),$height_offset,0,0,$width_rotate,$height_rotate); // Bild 2 oben
imagecopy ( $my_collage, $collage_pic2,($width_offset*2+$width_rotate),($height_rotate+(3*$height_offset)),0,0,$width_rotate,$height_rotate); // Bild 2 unten
$collage_pic3 = imagecreatefromjpeg($collagePhoto[2]) or die("no imagcreate");
imagecopy ( $my_collage, $collage_pic3,($width_offset*3+2*$width_rotate),$height_offset,0,0,$width_rotate,$height_rotate); // Bild 3 oben
imagecopy ( $my_collage, $collage_pic3,($width_offset*3+2*$width_rotate),($height_rotate+(3*$height_offset)),0,0,$width_rotate,$height_rotate); // Bild 3 unten
$collage_pic4 = imagecreatefromjpeg($collagePhoto[3]) or die("no imagcreate");
imagecopy ( $my_collage, $collage_pic4,($width_offset*4+3*$width_rotate),$height_offset,0,0,$width_rotate,$height_rotate); // Bild 4 oben
imagecopy ( $my_collage, $collage_pic4,($width_offset*4+3*$width_rotate),($height_rotate+(3*$height_offset)),0,0,$width_rotate,$height_rotate); // Bild 4 unten
break;
default:
break;
}
Is your feature request related to a problem? Please describe.
On my own wedding we had a photobooth which had a 2x4 layout for the collage function. We likes the layout, because with one print you had the pictures twice. The print was cut in half, so you had two picture stripes. One was for the guest book and the other for the guests.
Describe the solution you'd like
On my local code I implemented the layout for an older version. I am not into php, so it is not coded in a good way. It worked but the performance was bad. Unfortunately the code files are not matching with the new code structure so I attached the code parts which I implemented for the previous release. Maybe you can take it, improve it and add it as a new feature.
Describe alternatives you've considered
If you do not like it, you can also omit the layout.
config.inc.php
$config['collage_layout'] = '2x2'; // possible layouts are 2x2 and 2x4 (row x column)index.php
'collage_layout' => [ 'type' => 'select', 'name' => 'collage_layout', 'placeholder' => 'collage_layout', 'options' => [ '2x2' => '2x2', '2x4' => '2x4', ], 'value' => $config['collage_layout'] ]takePic.php