Giter VIP home page Giter VIP logo

thumbnail's People

Contributors

adepolas avatar ianmustafa avatar lakshmaji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

thumbnail's Issues

Why a try catch in the thumbnail.php?

Was wondering what the reason was for the throw in the thumbnail.php if there is an error?

Its a bit of a show stopper. If you try to make multiple images from a list of mp4s, and there is an error, eg file name incorrect, or is a dead link, the function stops. Would be good to have some set up to allow that to just return an error?

Best

Resizing does not work

It's resizing with height of 400, but in my thumbnail.php I've set dimensions.height to 240. What can it be?

Non-static method Lakshmaji\Thumbnail\Thumbnail::getThumbnail() should not be called staticall

I have follow each and every step while installing this package. i have also run

php artisan vendor:publish

it generated the "thumbnail.php" file in app/config.

i have also inlcuded FFMPEG configuration in .env file

FFMPEG_BINARIES=true
FFMPEG=/usr/bin/ffmpeg
FFPROBE=/usr/bin/ffprobe
FFMPEG_TIMEOUT=3600
FFMPEG_THREADS=12

by doing all these , getThumbanil() method isn't working. can you please guide me ?

i am using:

"php": ">=5.6.4",
"laravel/framework": "5.3.*",

Class 'FFMpeg\FFMpeg\FFMpeg' not found

Dear Lakshmaji,

I got this problem and I hope you can help me solve it:
After uploading the video to get the thumbnail I got this error:
FatalThrowableError in Thumbnail.php line 55: Class 'FFMpeg\FFMpeg\FFMpeg' not found

capture

My configuration in .env is:
`##thumbnail video
#Thumbnail image dimensions
THUMBNAIL_IMAGE_WIDTH = 320
THUMBNAIL_IMAGE_HEIGHT = 240

#Custom FFMPEG binaries path
FFMPEG_BINARIES=true
FFMPEG_PATH=C:\ffmpeg\bin\ffmpeg
FFPROBE_PATH=C:\ffmpeg\bin\ffprobe
FFMPEG_TIMEOUT=3600
FFMPEG_THREADS=12`

Thank you so much!

How to set size of the thumbnail?

As I see getThumbnail() function, it doesn't accept width and height as argument,
Can anyone guide me how can I set the width and height of the image?

$video_path = $path . '/' .$filename;
$thumbnail_path = public_path().'/uploads/tutorial-thumbnails';
$thumbnail_filename = $originalFilenameWithExt . '.jpg';
$time_to_image = 1;
$thumbnail_width  = 320;
$thumbnail_height = 240;

$thumbnail = new Thumbnail();
$thumbnail_status = $thumbnail->getThumbnail($video_path, $thumbnail_path, $thumbnail_filename, $time_to_image);

Thanks in Advance

Thumbnail for video url

It is possible to receive thumnail from a remote file (youtube, dailymotion, Vimeo, etc...) ?

5.4 compatibilty

Hi man,

I cant make a PR right now, but ThumbnailServiceProvider.php needs to be updated in order to compatible with Laravel 5.4.

Replace

$this->app['thumbnail'] = $this->app->share(function($app) {
      return new Thumbnail;
});

With

$this->app->singleton('thumbnail', function($app) {
      return new Thumbnail;
});

Should be working then.

Suggestion to change the $tts (TIME_TO_TAKE_SCREENSHOT) to 0 if the video length is below 10

Seriously, I'm pulling my hair out knowing what is wrong with my code. I noticed these issues when I was supplying videos below 10 seconds. Thumbnail::getThumbnail says it is successful but it is not generating an image. I looked into the source code until I saw the default seconds in $tts variable was 10 seconds.

Solution for this is supply the fourth argument with 0

Thumbnail::getThumbnail($video_path, $thumbnail_path, $thumbnail_file_name, 0);

Package update

Hello

I am writing code with Laravel and I am not able to retrieve your latest merge (of branch adepolas-patch-2) from composer.

I've done a composer update. But the class Thumbnail.php remains the same.

Do you know why ?

having issue while creating thumbnail

my code is like below please check it and correct me if i'm wrong

public function index(Request $request)

{
	$file = $request->file('file');
	$fb_user_id = 'user';

	$extension_type   = $file->getClientMimeType();
	$destination_path = public_path().'/uploads';

	$extension        = $file->getClientOriginalExtension();
	$timestamp        = str_replace([' ', ':'], '-', Carbon::now()->toDateTimeString());
	$file_name        = $timestamp;
	$upload_status    = $file->move($destination_path, $file_name);
    if($upload_status)
    {
      // file type is video
      // set storage path to store the file (image generated for a given video)

      $thumbnail_path   = public_path().'/images';

      $video_path       = $destination_path.'/'.$file_name;

      // set thumbnail image name
      $thumbnail_image  = $file_name.".jpg";
	  // $fp = fopen($thumbnail_path.'/'.$thumbnail_image, "w");

      // dd($thumbnail_path.'/'.$thumbnail_image);
      // set the thumbnail image "palyback" video button
      $water_mark       = public_path().'/watermark/p.png';

      // get video length and process it
      // assign the value to time_to_image (which will get screenshot of video at that specified seconds)
      $time_to_image    = '100';


      $thumbnail_status = Thumbnail::getThumbnail($video_path,$thumbnail_path,$thumbnail_image);
      // dd($thumbnail_status);
      if($thumbnail_status)
      {
        echo "Thumbnail generated";
      }
      else
      {
        echo "thumbnail generation has failed";
      }
    }
	// dd($file_name);
}`

Getting Error Width and height should be positive integer

I am using this library in laravel & getting error

"Width and height should be positive integer"

Here is my code:-

    public function thumb()
    {
        $watermark = public_path('/assets/images_upload/1535017656.png');
        $thumbnail_status = Thumbnail::getThumbnail(public_path('/assets/images_upload/1535450453.mp4'),public_path('/assets/thumbnail'),"pic.jpg",160,128,2,$watermark,true);
        
        if($thumbnail_status)
        {
            echo "Thumbnail generated";
        }
        
        else
        {
            echo "thumbnail generation has failed";
        }
    }

How to generate thumbnail from of video from s3 bucket

Here is my code

$movie = 'https://jogobucket-1.s3.eu-west-2.amazonaws.com/media/exercise/DV2/JOGO_D3.2_v2.mp4';
$thumbnail = new Thumbnail();
echo $thumbnail->getThumbnail($movie,public_path().'uploads','test.png',30);

The error is:
"message": "Unable to probe https://jogobucket-1.s3.eu-west-2.amazonaws.com/media/exercise/DV2/JOGO_D3.2_v2.mp4",
"exception": "Exception",
"file": "C:\wamp64\www\JOGO-PHP\vendor\lakshmaji\thumbnail\src\Thumbnail.php",
"line": 109,

Delay when generating video thumbnails

Hi every one, i noticed a mini delay when generating the thumbnail. Here is my situation: I 'm building a URL that accept media and from the media title I do a thumbnail from video or thumbnail from image depends of the mime_content_type. The plugin works fine but just asking is it normal to have let say 1 to 2 sec of delay. When i do the thumbnail from image it's super fast and when i do it with Thumbnails it take 1 to 2 sec to do it.
Here is a video to take a look.
Any help would help.

Thank you

IMG_2057.MOV

version

can i use it for laravel 5.8

# Lost after installation

I am trying to make a thumbnail from live streaming video, and i ended up here to try using it.
I followed the instruction of installation up to composer require lakshmajim/thumbnail.

Should I create a php file in my server and copy all the codes you provide in Thumbnail.php file that is in src folder?

Could you guide me a little bit for me?

New release v1.4.5 ?

Can you please release a latest version from you current master branch ?

Because v1.4.4 is still having the following line : FFMpeg\FFMpeg::create
Instead of : FFMpeg::create (currently on master)

It may fix almost all the 'Bad Cookie' errors.

Thanks ! ๐Ÿ‘

Thumbnail.php config problem ?

Hi again

Got bad cookie in /vendor/lakshmaji/thumbnail/src/Thumbnail.php:109

I haven't changed anything, just did the update for the package and it is broken. I am getting the "Got bad cookie" error..

Width and height should be positive integer

Hello, I am trying to generate a thumbnail with this code

$path = $request->media->store($mediaPath);

// generate thumbnail

$videoPath = storage_path('app/public/').$path;
$thumbnailPath = storage_path('app/public/');
$thumbnailImage = now()->timestamp.".jpg";
$time_to_image = 1;

$t_status = Thumbnail::getThumbnail($videoPath, $thumbnailPath, $thumbnailImage, $time_to_image);

if($t_status) {

    $media->path = $path;
    $media->thumbnail_path = $thumbnailPath.$thumbnailImage;
    $media->type = 'video';

} else {

    return response()->json(['error' => true]);
}

However, I keep getting Width and height should be positive integer.

I am using Laravel 7 and PHP 7.4

I am having an issue with creating thumnail images with file already stored in the disk

I am trying to create thumbnail image with the Laravel file storage system , but it does not work with the file already store on the disk let say public or s3 i get the following error
Exception: Unable to probe http://anotaistore.dev/storage/video/TbLAgDTXT1EDCiANartUe5gdTo76gRqn1CoTb7PC.mp4
the code is

public function store(Request $request, Video $video)
{
//Authorize the valide user
$this->authorize('upload', Video::class);

    // Validate the request
    $data = request()->validate([
        'video'       => 'required|mimeTypes:video/mp4|max:204800',
        'title'       => 'required',
        'description' => 'required',
    ]);

    //
    $file = request()->file('video');


    //  Store the file to the disk
    $storedFile = $file->store('video', 'public');

    //  set storage path to store the file (actual video)
    $storage = Storage::disk('public');
    $path    = $storage->url($storedFile);

    $thumbnail_image = $file->hashName() . ".jpg";

    $thumbnail_path = 'tempo';

    // This file is in project folder named tempo
    $file_in_project_folder = 'tempo/Alhimyri.mp4';
     
     
    Thumbnail::getThumbnail($path, $thumbnail_path, $thumbnail_image);


    // Append the url to data to be stored
    $dataToRecord = [
        'title'       => $data['title'],
        'description' => $data['description'],
        'url'         => $path,

    ];
    auth()->user()->createVideo($dataToRecord);

    return response(['Okay', 200]);
}

Please help what prevent generation thumnail from the disk,

But when i use the $file_in_project_folder = 'tempo/Alhimyri.mp4'; instead of $path on

Thumbnail::getThumbnail($path, $thumbnail_path, $thumbnail_image);
as
Thumbnail::getThumbnail($file_in_project_folder, $thumbnail_path, $thumbnail_image);

everthing work perfectly what is the issue here

Resize Does Not Work

This is probably a user error -- but maybe, maybe it's a bug.

I am not able to get the thumbnails to be resized.

Here is my thumbnail.php

<?php

/*
|--------------------------------------------------------------------------
| File which returns array of constants containing the thumbnail 
| integration configurations. 
|--------------------------------------------------------------------------
|
*/

return array(

    /*
    |--------------------------------------------------------------------------
    | FFMPEG BINARIES CONFIGURATIONS
    |--------------------------------------------------------------------------
    |
    | If you want to give binary paths explicitly, you can configure the FFMPEG 
    | binary paths set to the below 'env' varibales.
    |
    | NOTE: FFMpeg will autodetect ffmpeg and ffprobe binaries.
    |
    */

    'binaries' => [
        'enabled' => env('FFMPEG_BINARIES', false),
        'path'    => [
            'ffmpeg'  => env('FFMPEG_PATH', '/opt/local/ffmpeg/bin/ffmpeg'),
            'ffprobe' => env('FFPROBE_PATH', '/opt/local/ffmpeg/bin/ffprobe'),
            'timeout' => env('FFMPEG_TIMEOUT', 3600), // The timeout for the underlying process
            'threads' => env('FFMPEG_THREADS', 12), // The number of threads that FFMpeg should use
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Thumbnail image dimensions
    |--------------------------------------------------------------------------
    |
    | Specify the dimensions for thumbnail image
    |
    */

    'dimensions' => [
        'width'  => env('THUMBNAIL_IMAGE_WIDTH', 800),
        'height' => env('THUMBNAIL_IMAGE_HEIGHT', 800),
    ],

    /*
    |--------------------------------------------------------------------------
    | Thumbnail watermark alpha
    |--------------------------------------------------------------------------
    |
    | Specify the secret THUMBNAIL_X
    |
    */

    'watermark' => [
        'image' => [
            'enabled' => env('WATERMARK_IMAGE', false),
            'path'    => env('WATERMARK_PATH', 'http://voluntarydba.com/pics/YouTube%20Play%20Button%20Overlay.png'),
        ],
        'video' => [
            'enabled' => env('WATERMARK_VIDEO', false),
            'path'    => env('WATERMARK_PATH', ''),
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Thumbnail some x
    |--------------------------------------------------------------------------
    |
    | Specify the secret THUMBNAIL_X
    |
    */

    'THUMBNAIL_X' => '<YOUR_THUMBNAIL_X>',

);

// php artisan vendor:publish

// end of file thumbnail.php

Here is my env file

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

The thumbnail files are being generated, but they are the size of the video. I'd love to have them dropped to a square format.

Laravel Framework 6.16.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.