PHPackages                             digitaldream/photo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. digitaldream/photo

ActiveLibrary[Image &amp; Media](/categories/media)

digitaldream/photo
==================

Image manager

4.2.0(2y ago)314851[1 issues](https://github.com/digitaldreams/photo/issues)[11 PRs](https://github.com/digitaldreams/photo/pulls)MITPHPPHP ^8.0

Since Sep 21Pushed 2y ago2 watchersCompare

[ Source](https://github.com/digitaldreams/photo)[ Packagist](https://packagist.org/packages/digitaldream/photo)[ Docs](https://github.com/digitaldreams/photo)[ RSS](/packages/digitaldream-photo/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (4)Versions (44)Used By (0)

Laravl Photo Manager
====================

[](#laravl-photo-manager)

Laravel Photo Manager

### Installation

[](#installation)

**Step one**

```
 composer require digitaldream/photo
```

**Step Two**Run Migration

```
 php artisan migrate
```

**Step Three**

```
 php artisan vendor:publish --provider="Photo/PhotoServiceProvider"
```

It will publish config, views file. Feel free to edit these files according to your project need.

**Step Four**

Browse **/photo/photos** to start using this library

### Configure Policy

[](#configure-policy)

You can configure who can have what permissions on this photo library. Create a new class and extends it from `Photo\Policies\PhotoPolicy` like below.

```
 namespace App\Policies;

 use Photo\Policies\PhotoPolicy as Policy;

  class PhotoPolicy extends Policy
  {
      /**
       * @param \App\Models\User $user
       *
       * @return bool
       */
      public function viewAny($user): bool
      {
          return $user->isTeacher();
      }
  }
```

As you can see we override viewAny method. Now a Teacher can view list of all photos. Other methods like `before`,`view`,`create`,`update`,`delete` can be override too. Now to register this Policy class lets change `policy` key on `config/photo.php`

```
#file config/photo.php

'policy' => \App\Policies\PhotoPolicy::class,

```

### Features

[](#features)

1.Drag and Drop from Web.

2.Drag and Drop from Local machine

3.Crop and Resize

4.Webp conversion

5.Copy image URL and share to the Web

7.Size configurable and thumbnails generation

8.SEO friendly filename.

9.Translation

10.PHPunit test classes included. [![Drag n Drop from local machine](https://camo.githubusercontent.com/f68b42a4347ac9fbc7464320b43b05e9d59dc465758e238dcff9e9cfba0682de/68747470733a2f2f692e6962622e636f2f793437485033672f53637265656e73686f742d323032302d31312d30372d61742d31312d31392d31332d504d2e706e67)](https://camo.githubusercontent.com/f68b42a4347ac9fbc7464320b43b05e9d59dc465758e238dcff9e9cfba0682de/68747470733a2f2f692e6962622e636f2f793437485033672f53637265656e73686f742d323032302d31312d30372d61742d31312d31392d31332d504d2e706e67)[![Resize-image](https://camo.githubusercontent.com/b17e40dc188a0436b8ab874731043f5f1e97b740eef082f27db3c7c8bcc2d520/68747470733a2f2f692e6962622e636f2f327454315734302f526573697a652d696d6167652e706e67)](https://camo.githubusercontent.com/b17e40dc188a0436b8ab874731043f5f1e97b740eef082f27db3c7c8bcc2d520/68747470733a2f2f692e6962622e636f2f327454315734302f526573697a652d696d6167652e706e67)

### How to use in a Model as BelongsTo

[](#how-to-use-in-a-model-as-belongsto)

First of all you need to put a line on your model migration for example posts.

```
$table->foreign('photo_id')->references('id')->on('photo_photos')->onDelete('set null');
```

Secondly you need to define relation on your model.

```
    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function photo()
    {
        return $this->belongsTo(\Photo\Models\Photo::class, 'photo_id');
    }
```

Third. Lets make upload on controller.

```
    /**
    * @var \Photo\Repositories\PhotoRepository
    */
    protected $photoRepository;

    public function __construct(PhotoRepository $photoRepository)
    {
        $this->photoRepository = $photoRepository;
    }

    public function store(StoreRequest $request)
    {
    //Your other code.
        $post->photo_id = $this->photoRepository->create($file, ['caption' => $data['title']])->id;
    }
```

You must resolve `\Photo\Repositories\PhotoRepository` via `__construction` Dependency injection.

Finally. Its time to render image to view.

```
 {!! $post->photo->renderThumbnails() !!}
```

This will render following html code.

```

```

Above code will render thumbnails in both webp and uploaded extension. To render larger image do following

```
    {!! $post->photo->render('card-img-top') !!}
```

Here render method take class name as first argument and style as second.

### How to upload file and get file path only.

[](#how-to-upload-file-and-get-file-path-only)

```
    namesapce App\Repositories;

    class PostRepository
    {
       /**
        * @var \Photo\Services\PhotoService
        */
        protected PhotoService $photoService;

        public function __construct(PhotoService $photoService)
        {
            $this->photoService = $photoService;
        }

        public function store(Request $request)
        {
            $post = new Post();
            $post->fill($request->all());

            $mainImageFolder = "posts"
            $thumbnailWidth = 220;
            $thumbnailHheight= 200;
            $crop="no"; // "yes" will resize image automatically based on your maximum height,width.
            $thumbnailPath = "thumbnails"; // Thumbnails path are relative to main Image folder.
                                            //In this case it will create a folder thumbnails under posts folder.

            $post->image =  $this->photoService
                                    ->setDimension($thumbnailWidth, $thumbnailHheight, $thumbnailPath)
                                    ->store($mainImageFolder, $request->file('file'), $post->title, $crop)
                                    ->convert()
                                    ->getStoredImagePath();
            $post->save();

        }

    }
```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~64 days

Recently: every ~250 days

Total

30

Last Release

804d ago

Major Versions

1.1.0 → 2.0.02020-06-05

2.0.1 → 3.0.02020-07-02

3.3.7 → 4.0.02021-07-19

PHP version history (7 changes)1.0.0PHP &gt;=5.5.9

1.1.0PHP &gt;=7.0.0

2.0.0PHP &gt;=7.2.0

3.0.0PHP &gt;=7.4.0

3.3.7PHP ^7.4

4.0.0PHP ^7.4|^8.0

4.1.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6059541?v=4)[Tuhin Bepari](/maintainers/digitaldreams)[@digitaldreams](https://github.com/digitaldreams)

---

Top Contributors

[![digitaldreams](https://avatars.githubusercontent.com/u/6059541?v=4)](https://github.com/digitaldreams "digitaldreams (113 commits)")

---

Tags

galleryimage-processingintervention-imagelaravel-5-packagelaravel-packagephoto-gallery

### Embed Badge

![Health badge](/badges/digitaldream-photo/health.svg)

```
[![Health](https://phpackages.com/badges/digitaldream-photo/health.svg)](https://phpackages.com/packages/digitaldream-photo)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.3k2.2k](/packages/unopim-unopim)[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.6M217](/packages/backpack-crud)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.4k169.0k9](/packages/bagisto-bagisto)[eveseat/web

SeAT Web Interface

2623.4k149](/packages/eveseat-web)[justbetter/statamic-image-optimize

Image optimization after upload

1318.4k](/packages/justbetter-statamic-image-optimize)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
