PHP code example of lassehaslev / laravel-image

1. Go to this page and download the library: Download lassehaslev/laravel-image 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/ */

    

lassehaslev / laravel-image example snippets



return [
    'owner'=>null, // Set to set a owner object f.eks. 'App\User' 
    'folder'=>'uploads/images', // Folder to upload to
    'routes'=>'/', // Route group name. To prevent setting routes set null
];

@extends( 'backend' )

@section( 'content' )

@on

// Upload new image
$image = Image::upload( UploadedFile $file );

// Get relative path
echo $image->path;

// Get full path
echo $image->path();

// Get url
echo $image->url();

// Delete
$image->delete();

// Update/Change image content
$image->uploadImage( UploadedFile $file );
config/app.php
bash
php artisan migrate
resources/views/vendor/images/index.blade.php