1. Go to this page and download the library: Download dot-env-it/collage library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use DotEnvIt\Collage\Facades\Collage;
$imagePaths = [
'/storage/app/public/photos/img1.jpg',
'/storage/app/public/photos/img2.jpg',
'/storage/app/public/photos/img3.jpg',
];
// Returns instance of Collage after writing to disk
$collage = Collage::make()
->from($imagePaths)
->save('collages/event-101.jpg');
// Extract the absolute local file path (perfect for PDF engines)
$absolutePath = Collage::make()
->from($imagePaths)
->save('collages/event-101.jpg')
->getPath();
// Returns: "/home/user/app/storage/app/public/collages/event-101.jpg"
// Extract the publicly accessible public asset URL string
$publicUrl = Collage::make()
->from($imagePaths)
->save('collages/event-101.jpg')
->getUrl();
// Returns: "[https://your-domain.com/storage/collages/event-101.jpg](https://your-domain.com/storage/collages/event-101.jpg)"
$customCollagePath = Collage::make()
->from($imagePaths)
->width(1600) // Enforce a crisp wider base profile
->height(1200) // Expand vertical space threshold limit
->disk('local')
->save('collages/high-res-event.jpg')
->getPath();