Skip to content

barrydevt/imagepal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Imagepal

An expressive image helper for Laravel.

  • Save / tag images against any model.
  • Manipulate images on the fly.

Getting Started

  1. Install the package from composer
  2. Run the migration script
  3. Add the HasModelImage trait to your model, so for example, if you want to add avatar images to your User model, add the following trait:
<?php

namespace App\Models;

use Barrydevt\Imagepal\Concerns\HasModelImages;

class User extends Authenticatable
{
    use HasModelImages;

    protected $images = [
        'avatar' => [
            'size' => [100,100]
        ]   
    ];
  1. Save an avatar image with the image pal facade:
$user = User::find(1);
$user->images()->save('https://www.image.com/image.png');
  1. Now you have the image saved, you can use it in your blade templates:
<img src="{{ $user->images('avatar')->url }}" alt="{{ $user->images('avatar')->alt }}" />

About

Easy image manipulation with Laravel and Image Kit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages