Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue? #1098

Closed
ProteanCode opened this issue Jul 11, 2021 · 2 comments
Closed

Performance issue? #1098

ProteanCode opened this issue Jul 11, 2021 · 2 comments

Comments

@ProteanCode
Copy link

ProteanCode commented Jul 11, 2021

I have created a code that should be quite good at reproducing the performance issue

    private static function createMultipleImages(UploadedFile &$uploadedFile, string $outputFormat='webp') {
        $filename = 'myOutputImage';
        for($i = 1; $i< 6; $i++) {
            $width = 200 * $i;
            $image = Image::make($uploadedFile->getRealPath())->encode($outputFormat);
            if($image->width() >= $width) {
                $image->resize($width, null, function ($constraint) {
                    $constraint->aspectRatio();
                    $constraint->upsize();
                });
                $image->save(__DIR__.'/'.$filename.'_'.$width.'.'.$outputFormat);
            }
            $image->destroy();
            $image = null;
        }
    }

Didn't run it, but the concept is the same.

The input on which I do test that function is some image from unsplashd with 6000x4000 dimension and around 3MB in size;

Execution time is calculated in like half a minute, maybe more, it is just highlt noticeable and I may just do something wrong there.

Maybe the webp is the reason why, or I should compile my alpine docker image with some extra settings

desert

@tsmgeek
Copy link

tsmgeek commented Aug 26, 2021

You have not indicated which driver you are using.

@olivervogel
Copy link
Member

I think this is not related to this library but to the performance of GD or Imagick in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants