GithubHelp home page GithubHelp logo

laravel-image-optimizer's People

Contributors

approached avatar ctf0 avatar danjdewhurst avatar freekmurze avatar pablood85 avatar rasim avatar rdok-pigogo avatar ricardoramirezr avatar rspahni 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  avatar  avatar  avatar

laravel-image-optimizer's Issues

Class ImageOptimizer does not exist

after use code :

Route::get('ttt' , function(ImageOptimizer $imageOptimizer){

    $picture = asset('s.jpg'); // image in root directory
    // optimize
    $imageOptimizer->optimizeUploadedImageFile($picture);

    // save
    Storage::put('public/ttyy.jpg', File::get($picture));

}

Error : Class ImageOptimizer does not exist

Dose Not Exist

ReflectionException in RouteSignatureParameters.php line 25:
Class App\Http\Controllers\ImageOptimizer does not exist
screencapture-jmtit-app-maheshsales-com-addproduct-1499585417700

Command "/usr/bin/jpegoptim" not found.

Hi,

I tried using the package and i'm using windows 8.1 and laravel 5.2 for my development env, and this is the error ( Command "/usr/bin/jpegoptim" not found) it showed me, can't find how to install the jpegoptim lib, is this package only for linux? please advise.

Thanks,

100% CPU usage

When optimizing an image, my CPU usage jumps to 100% (I'm using DigitalOcean's $5/mo plan).

Is this normal? Is there anything I can do to lower the usage other than upgrading my server?

What if I need to optimize uploaded images from 100 users at the same time?

Why download libraries not show folder Middleware in src ???

Hello Mr.ctf0,approached !!!
Thanks you was support for me with libraries this. But i have one question small.
When i downloaded libraries by composer into project of me was completed but I not found folder Middleware into vendor approached.
I hope you will looking for it and answer for me.
Thanks

File extension capitalized

Hello!

A user on one of my sites just tried to upload an image with a capitalized extension (for example: myprofilepicture.JPG) and the optimizeImage function threw the following exception:

'TransformHandler for file extension: "JPG" was not found'

An easy and dirty fix for this is just to add capitalized versions for each transform_handler in the config but obviously it would be nicer to get this fixed in this package.

Cheers.

how to pass options?

Hi, I need to configure the optimizer to use the jpegoptim –max option ...... how can I accomplish this? Is it possible?

Undefined index: inode/x-empty

Next ErrorException: Undefined index: inode/x-empty (View: /var/www/app/resources/views/components/product-grid-item.blade.php) (View: /var/www/app/resources/views/components/product-grid-item.blade.php) in /var/www/app/vendor/approached/laravel-image-optimizer/src/ImageOptimizer.php:26
Stack trace:
#0 /var/www/app/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(44): Illuminate\View\Engines\CompilerEngine->handleViewException(Object(ErrorException), 1)
#1 /var/www/app/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/var/www/app/st...', Array)
#2 /var/www/app/vendor/laravel/framework/src/Illuminate/View/View.php(149): Illuminate\View\Engines\CompilerEngine->get('/var/www/app/re...', Array)
#3 /var/www/app/vendor/laravel/framework/src/Illuminate/View/View.php(120): Illuminate\View\View->getContents()
#4 /var/www/app/vendor/laravel/framework/src/Illuminate/View/View.php(85): Illuminate\View\View->renderContents()
#5 /var/www/app/vendor/laravel/framework/src/Illuminate/Http/Response.php(45): Illuminate\View\View->render()
#6 /var/www/app/vendor/symfony/http-foundation/Response.php(201): Illuminate\Http\Response->setContent(Object(Illuminate\View\View))
#7 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View))
#8 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(653): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View))
#9 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#10 /var/www/app/app/Http/Middleware/CheckGuest.php(32): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#11 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): App\Http\Middleware\CheckGuest->handle(Object(Illuminate\Http\Request), Object(Closure))
#12 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#13 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#14 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#15 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#16 /var/www/app/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#17 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#18 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#19 /var/www/app/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#20 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#21 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#22 /var/www/app/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#23 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#24 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#25 /var/www/app/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#26 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#28 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#29 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(655): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#30 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(629): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#31 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(607): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#32 /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(268): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#33 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#34 /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#35 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#37 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#38 /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(150): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#39 /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(117): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#40 /var/www/app/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#41 {main}

Lumen support

I wonder, is it really necessary for this package to require the entire laravel/framework meta-package ?

Is there a chance to make this work on Lumen without requiring laravel/framework ?

Check if command exists

File: ImageOptimizer/Command.php@23
if(!is_executable($this->cmd)) {

It would be better if you check first with "which jpegoptim", becouse it can happen that command is accesible only with absolut path "/usr/bin/jpegoptiom".

Nothing to publish

Hello,

I run the command composer required on the local then uploaded the files on the server, because it was returning killed when i was running the commend on the server directly. Then i added the service provider.

And when i add the
php artisan vendor:publish --tag=imageoptimizer

I got the following error
Nothing to publish for tag [imageoptimizer].

optimizeImage returns null

How can we use optimizeImage() with an existing file without using an "uploaded" one? At this time it returns null.

Otherwise it will be a good thing to use optimizeImage with an encoded image.

TransformHandler not found in production

Hi,

I have the same application in the same server only with different ENV options and different folders.
In the staging environment when I try to upload a image from iPhone, it's work fine.

When I try upload the same image on the production I'm receiving the message:
TransformHandler for file extension: \"jpg\" was not found

I'm using like this:

   $imageOptimizer = app('Approached\LaravelImageOptimizer\ImageOptimizer');
   $imageOptimizer->optimizeUploadedImageFile($attachment);

And everything other stuffs are fine. Any ideas?

How to use ONLY optipng?

I want to use optipng instead of pngquant for PNG images. How can I do this in the code?

I edited the config file in /vendor/approached/laravel-image-optimizer/config:

'transform_handler' => [
    'png'  => 'optipng',
    'jpg'  => 'jpegoptim',
    'jpeg' => 'jpegoptim',
    'gif'  => 'gifsicle',
],

And I uncommented the lines for optipng:

'optipng_bin' => '/usr/local/bin/optipng',
'optipng_options' => ['-o2', '-quiet'],

But when the optimizer runs, it still outputs the PNG using the pngquant algorithms.

config file options are ignored

Hello, I was trying to compress a jpg, but the size remained intact.
After some debugging, I found that there is no compression setted by default, so I added a new argument in this config line:

'jpegoptim_options' => ['--strip-all', '--all-progressive', '--max60'],

But nothing seems to happen, the config parameters are never merged with the default ones.

Is this a known issue?
What can I do to fix it?

Thanks

jpegoptim options not running

I am using jpegoptim. Here is my config:

    'options' => [
        'ignore_errors' => false,

        'optipng_bin' => '/usr/bin/optipng',
        'optipng_options' => ['-force'],

        'gifsicle_bin'     => '/usr/bin/gifsicle',
        'gifsicle_options' => ['-b', '-O5'],

        'jpegoptim_bin'     => '/usr/bin/jpegoptim',
        'jpegoptim_options' => ['-m80'],
    ],

    'transform_handler' => [
        'png'  => 'optipng',
        'jpg'  => 'jpegoptim',
        'jpeg' => 'jpegoptim',
        'gif'  => 'gifsicle',
    ],

But when I run the code, the package compresses it using lossless compression (instead of lossy compression (-m80) like I set in the config:

$pic = public_path('landscape.jpg');
$imageOptimizer = new ImageOptimizer();
$imageOptimizer->optimizeImage($pic);

But when I run the command in the command line, it works fine:

jpegoptim -m80 landscape.jpg

I only have jpegoptim and not jpegtran.

What am I doing wrong?

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.