Created
March 20, 2024 08:50
-
-
Save tarikmanoar/1799278d6ca3edc4da7f4b88f9afcad8 to your computer and use it in GitHub Desktop.
Inserting Images (Like prothomalo.com)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install Latest "intervention/image": "3.5.0", | |
composer require intervention/image 3.5.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('image', function () { | |
$client = new Client(); | |
$source = $client->get('https://picsum.photos/728/410'); | |
$overly = $client->get('https://picsum.photos/728/45'); | |
$source = $source->getBody()->getContents(); | |
$overly = $overly->getBody()->getContents(); | |
$manager = ImageManager::gd(); | |
$image = $manager->read($source); | |
$img = $image->place($overly, 'bottom'); | |
return response($img->encodeByExtension('png'), 200)->header('Content-Type', 'image/jpeg'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment