1. Go to this page and download the library: Download cbcaio/image-attacher 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/ */
cbcaio / image-attacher example snippets
$upload = Input::file('image');
$model->addImage($upload);
// Directly from $request
$model->addImage($request->file('image'));
// With parameters
$model->addImage($request->file('image', 'processing_style_routine','newfilename.jpg'));
// The same as adding, the package will identify if the model already has an image, delete the previous
images and update the relationship.
$upload = Input::file('image2');
$model->addImage($upload);
$model->deleteImage();
bash
$ php artisan vendor:publish
$model->addImage(uploaded_file,'default_routine');
....
'default_routine' =>
[
'original_style' => function ($image) {
return $image;
},
'thumbnail' => function ($image) {
$image->resize(null, 500, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
});
return $image;
},
]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.