Laravel-medialibrary: Large resolution image - long time conversation

Created on 7 Nov 2016  路  5Comments  路  Source: spatie/laravel-medialibrary

i have a problem with long time loading few photos with resolution 4400x4400. it`s take about 4s.
can i do something to speed it up?.

$this->addMediaConversion('1000x1000') ->setManipulations(['w' => 1000, 'h' => 1000]) ->performOnCollections('main');

when i remove Converstion its ok. do you have any idea what can i do? i add about 6-8 images * 4s = too long :)

Most helpful comment

@nicolasbeauvais 馃檶

All 5 comments

That's some really big file to convert !

What I would try:

  • Increase the server hardware memory / CPU
  • Increase PHP memory limit
  • Use a queue driver (SQS / Redis / Beanstalk) to perform the conversion in deferred
  • Try Imagick instead of GD (not sure if it's faster but you can try) described in https://github.com/spatie/laravel-medialibrary/issues/375

I don't think we can speed that up much. In order to manipulate the image PHP needs to load it in it's entirety and perform the manipulations on that loaded image. 4400x4400 equals a shitload of pixels 馃槃

You can speed this up by upgrading the cpu. If your front most request hangs because of the generation of the image you could push the generation to a queue.

@nicolasbeauvais 馃檶

thanks for your very fast answer. can you send me some link how to push it to queue?

Read the documentation on Defining conversions. It mentions how you can perform the manipulation in a queued or non-queued manner.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stayallive picture stayallive  路  4Comments

kickthemooon picture kickthemooon  路  4Comments

intrepidws picture intrepidws  路  3Comments

jam1e picture jam1e  路  3Comments

Nks picture Nks  路  3Comments