PHPackages                             elsayed85/thumbnail - 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. elsayed85/thumbnail

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

elsayed85/thumbnail
===================

v2.0.0(3y ago)065MITPHP

Since May 12Pushed 3y agoCompare

[ Source](https://github.com/elsayed85/Thumbnail)[ Packagist](https://packagist.org/packages/elsayed85/thumbnail)[ RSS](/packages/elsayed85-thumbnail/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (13)Used By (0)

Thumbnail
=========

[](#thumbnail)

[![Latest Stable Version](https://camo.githubusercontent.com/493cd7f877c365ab3f5972dd6678daa558dddc67020d8da351fb8ea489c898fe/68747470733a2f2f706f7365722e707567782e6f72672f6c616b73686d616a696d2f7468756d626e61696c2f762f737461626c65)](https://packagist.org/packages/lakshmajim/thumbnail)[![Total Downloads](https://camo.githubusercontent.com/0553458860ea0a9f8d5d5a3185ec6bb91ce5ac6543ec5e248251618fe12dd255/68747470733a2f2f706f7365722e707567782e6f72672f6c616b73686d616a696d2f7468756d626e61696c2f646f776e6c6f616473)](https://packagist.org/packages/lakshmajim/thumbnail)[![Latest Unstable Version](https://camo.githubusercontent.com/4c25ca4e57b7fb5f3b8a64bd8fc334031dd1f92795870b279dbb740207bb5c24/68747470733a2f2f706f7365722e707567782e6f72672f6c616b73686d616a696d2f7468756d626e61696c2f762f756e737461626c65)](https://packagist.org/packages/lakshmajim/thumbnail)[![License](https://camo.githubusercontent.com/1ee4e20bf02dd74e5dfbc11bf7a0b7f7d360ec1cc795d783fede267069b76109/68747470733a2f2f706f7365722e707567782e6f72672f6c616b73686d616a696d2f7468756d626e61696c2f6c6963656e7365)](https://packagist.org/packages/lakshmajim/thumbnail)[![Monthly Downloads](https://camo.githubusercontent.com/f731dcd4f621e5c78d7958327dfd7a2d94630e5d7f5f2f045301f429e749773f/68747470733a2f2f706f7365722e707567782e6f72672f6c616b73686d616a696d2f7468756d626e61696c2f642f6d6f6e74686c79)](https://packagist.org/packages/lakshmajim/thumbnail)[![Daily Downloads](https://camo.githubusercontent.com/8fb19765902bd2812231300ff8556feb2cf0337c6d2fb764ff242f4ed1e603bf/68747470733a2f2f706f7365722e707567782e6f72672f6c616b73686d616a696d2f7468756d626e61696c2f642f6461696c79)](https://packagist.org/packages/lakshmajim/thumbnail)[![composer.lock](https://camo.githubusercontent.com/bd28cde0bb4fe26ca0f5c193f0e402a08f5fd6f05f936541ffb0a953f62b0b38/68747470733a2f2f706f7365722e707567782e6f72672f6c616b73686d616a696d2f7468756d626e61696c2f636f6d706f7365726c6f636b)](https://packagist.org/packages/lakshmajim/thumbnail)

[Wiki on web](http://lakshmaji.github.io/Thumbnail/)

> ### INDEX
>
> [](#index)

IndexDescription[What it is](https://github.com/lakshmaji/Thumbnail#what-it-is)- Introduction[Installing FFMpeg](https://github.com/lakshmaji/Thumbnail#installing-dependency-software)- Installing dependency software[Installation](https://github.com/lakshmaji/Thumbnail#installation)- Installing Thumbnail package, Lararavel Integration[Docs](https://github.com/lakshmaji/Thumbnail#method)- Methods and Description[Generating Thumbnail](https://github.com/lakshmaji/Thumbnail#genearting-thumbnail)- Generating thumbnail image with this package[Miscellaneous](https://github.com/lakshmaji/Thumbnail#miscellaneous)- Miscellaneous content regarding method calls[License](https://github.com/lakshmaji/Thumbnail#license)- License Information> ### What it is
>
> [](#what-it-is)

- Generates Thumbnail (image) for a given video
- This uses **FFMpeg**.
- Converts video to WebM format.

> ### Version
>
> [](#version)

1.4.5

> ### Compatibility
>
> [](#compatibility)

**Laravel version****Thumbnail version**5.61.4.55.51.4.55.41.4.55.21.4.5 or 1.4.2 or 1.3.05.11.4.5 or 1.4.2 or 1.3.05.01.4.5 or 1.4.2 or 1.3.0**Note:** For **1.4.3** and other **earlier** version documentation refer [here](https://github.com/lakshmaji/Thumbnail/blob/4ec692054a6541bb46eae6802a2b09138ce156b8/README.md)

---

> ### Installing dependency software
>
> [](#installing-dependency-software)

This package relays on [FFMpeg](https://en.wikipedia.org/wiki/FFmpeg), A complete, cross-platform solution to record, convert and stream audio and video i.e, Multimedia .

#### Installing FFMpeg on 16.04 (Xenial Xerus) LTS

[](#installing-ffmpeg-on--1604-xenial-xerus-lts)

- Run following command to install FFMpeg

    ```
    sudo apt-get update
    sudo apt-get install ffmpeg
    ```

#### Installing FFMpeg on Ubuntu 14.04 LTS

[](#installing-ffmpeg-on-ubuntu-1404--lts)

- Add the mc3man ppa

    ```
    sudo add-apt-repository ppa:mc3man/trusty-media
    ```
- Run following command to Update the package list.

    ```
    sudo apt-get update
    sudo apt-get update sudo apt-get dist-upgrade
    ```
- Now FFmpeg is available to be installed with **apt** , Run this command

    ```
    sudo apt-get install ffmpeg

    ```

#### Installing FFMpeg on CentOS

[](#installing-ffmpeg-on-centos)

- Enable EPEL repository

    - for centos 6

        ```
           rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
        ```
    - for centos 5

        ```
           rpm -Uvh http://mirrors.kernel.org/fedora-epel/5/i386/epel-release-5-4.noarch.rpm
        ```
    - for centos 7

        ```
           yum install epel-release
        ```
- Check whether EPEL respository is eabled by the following command

    ```
       yum repolist
    ```
- Import the official GPG key of Nux Dextop repository:

    ```
       rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
    ```

##### Nux Dextop is a third-party RPM repository which contains many popular desktop and multimedia related packages (e.g., Ardour, Shutter, etc) for CentOS, RHEL and ScientificLinux. Currently, Nux Dextop repository is available for CentOS/RHEL 6 and 7.

[](#nux-dextop-is-a-third-party-rpm-repository-which-contains-many-popular-desktop-and-multimedia-related-packages-eg-ardour-shutter-etc-for-centos-rhel-and-scientificlinux-currently-nux-dextop-repository-is-available-for-centosrhel-6-and-7)

- Install Nux Dextop with yum command as follows.

    - centos 6

        ```
        rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
        ```
    - centos 7

        ```
        rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
        ```
- Now verify that Nux Dextop repository is successfully installed:

    ```
       yum repolist
    ```
- Run following command to install FFMpeg

    ```
       yum install ffmpeg
    ```

#### Installing FFMpeg on Windows

[](#installing-ffmpeg-on-windows)

Refer to the following links

[WikiHow](http://www.wikihow.com/Install-FFmpeg-on-Windows)

[AdapticeSolutions](http://adaptivesamples.com/how-to-install-ffmpeg-on-windows/)

---

> ### Installation
>
> [](#installation)

- This package is available on packagist

```
    composer require lakshmaji/thumbnail
```

- Add the Service Provider to **providers** array

```
Lakshmaji\Thumbnail\ThumbnailServiceProvider::class,
```

- Add the Facade to **aliases** array

```
'Thumbnail' => Lakshmaji\Thumbnail\Facade\Thumbnail::class,
```

- Try updating the application with composer (dependencies but not mandatory 😉 )

```
  composer update
```

---

---

> ### Configurations
>
> [](#configurations)

- Publish the configuration file , this will publish thumbnail.php file to your application **config** directory.

```
    php artisan vendor:publish
```

- Configure the required FFMpeg configurations.
- FFMpeg will autodetect ffmpeg and ffprobe binaries. If you want to give binary paths explicitly, you can configure them in **.env** file.
- You can specify the output image dimensions in .env file. (dimensions array parameters)
- Add watermark or playback button url to **watermark** arry aviable in thumbnail.php
- Or you can configure them from laravel .env file, the sample watermark resource configurations in .env file

```
#Thumbnail image dimensions
THUMBNAIL_IMAGE_WIDTH  = 320
THUMBNAIL_IMAGE_HEIGHT = 240

#Watermark image
WATERMARK_IMAGE = true
WATERMARK_PATH  = /var/www/html/thumb/storage/watermark/p.png

#Custom FFMPEG binaries path
FFMPEG_BINARIES = true
FFMPEG_PATH     = /opt/local/ffmpeg/bin/ffmpeg
FFPROBE_PATH    = /opt/local/ffmpeg/bin/ffprobe
FFMPEG_TIMEOUT  = 3600
FFMPEG_THREADS  = 12
```

This ensures that all the generated thumbnails with watermarks are having fixed dimensions

---

> ### Generating Thumbnail
>
> [](#generating-thumbnail)

The following example illustrates the usage of Thumbnail package

```
