Skip to content

How to optimise images? #212

Description

@ericmp33

Shouldn't the image be lighter after optimising it?

$filePath = public_path('img/testImg.png');

dd(
    \Illuminate\Support\Number::fileSize(
        bytes: filesize($filePath),
        precision: 3,
    ),

    \Spatie\Image\Image::load($filePath)
        ->optimize()
        ->save()
    ,

    \Illuminate\Support\Number::fileSize(
        bytes: filesize($filePath),
        precision: 3,
    ),
);
Screenshot 2024-03-06 at 14 27 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions