Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $imagenes = array('foto1.jpg', 'foto2.jpg');
- $i = 0;
- $img_canvas = Image::canvas(1800, 1800);
- foreach($imagenes as $img) {
- if($img) {
- $path = public_path($img);
- switch($i) {
- case 0:
- $img_canvas->insert($path, 'left');
- break;
- case 1:
- $img_canvas->insert($path, 'right');
- break;
- }
- }
- $i++;
- }
- $img_canvas->save(public_path('image_merged.jpg'), 100);
- $img = Image::make(public_path('image_merged.jpg'));
- $img->resize(900, null, function ($constraint) {
- $constraint->aspectRatio();
- })->save(public_path('image_merged.jpg'), 100);
Add Comment
Please, Sign In to add comment