GithubHelp home page GithubHelp logo

joshembling / image-optimizer Goto Github PK

View Code? Open in Web Editor NEW
56.0 4.0 12.0 203 KB

๐ŸŽจ Optimize your Filament images before they reach your database.

Home Page: https://filamentphp.com/plugins/joshembling-image-optimizer

License: MIT License

PHP 100.00%
filament filament-plugin filamentphp image laravel optimization

image-optimizer's People

Contributors

dependabot[bot] avatar joshembling 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

Watchers

 avatar  avatar  avatar  avatar

image-optimizer's Issues

[Bug]: Class "Intervention\Image\ImageManagerStatic" not found

What happened?

I followed the installation steps correctly, but when using it it shows the class not found error.
Step to install:
composer require joshembling/image-optimizer

How to reproduce the bug

After installing, I tried to perform the optimization, but it shows me the following error:
Class "Intervention\Image\ImageManagerStatic" not found.

Package Version

lastest

PHP Version

8.1.12

Laravel Version

10.28.0

Which operating systems does with happen with?

Windows

Notes

No response

[Bug]: Undefined variable $getUploadingMessage

What happened?

After updating filament, I encountered errors indicating an Undefined variable $getUploadingMessage. Any insights or resolutions to rectify this issue would be greatly appreciated. Thanks.

How to reproduce the bug

Once updating to latest filament version

Package Version

1.2.0

PHP Version

8.2.15

Laravel Version

10.42.0

Which operating systems does with happen with?

No response

Notes

No response

[Bug]: Cannot use in filamentphp with livewire

What happened?

Is this extension cannot be use inside livewire with filament/forms? would be very happy if this extension could be used on livewire

How to reproduce the bug

I cannot use the optimize() method after install package. I already do composer update but still doesn't work on livewire with filament/form

Package Version

latest

PHP Version

8.2

Laravel Version

11.8

Which operating systems does with happen with?

Windows

Notes

No response

[Bug]: Not able to update to v1.3 due to intervention/image ^2.7 dependency

What happened?

I am on Filament ^3.2.
I am using intervention/laravel-image in other parts of my laravel backend, which causes issues when I want to use "joshembling/image-optimizer": "^1.3", and I run composer update:

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires intervention/image-laravel ^1.0 -> satisfiable by intervention/image-laravel[1.0.0, 1.0.1].
    - intervention/image-laravel[1.0.0, ..., 1.0.1] require intervention/image ^3 -> satisfiable by intervention/image[3.0.0, ..., 3.3.3].
    - You can only install one version of a package, so only one of these can be installed: intervention/image[2.7.0, 2.7.1, 2.7.2, 3.0.0, ..., 3.3.3].
    - joshembling/image-optimizer[v1.3.0, ..., v1.3.1] require intervention/image ^2.7 -> satisfiable by intervention/image[2.7.0, 2.7.1, 2.7.2].
    - Root composer.json requires joshembling/image-optimizer ^1.3 -> satisfiable by joshembling/image-optimizer[v1.3.0, v1.3.1].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

I would expect that these composer update problems would not occur, which would be fixed if the used version of intervention/image was bumped to ^3?

How to reproduce the bug

Install intervention/image-laravel with:

composer require intervention/image-laravel

Then install image-optimzer with:

composer require joshembling/image-optimizer

Then update composer.json to bump joshembling/image-optimizer to ^1.3, then run:

composer update

OR

Alternatively just try to install joshembling/image-optimizer v1.3 directly after installing intervention/image-laravel:

composer require joshembling/image-optimizer:v1.3

Package Version

1.1

PHP Version

8.2

Laravel Version

10.43.0

Which operating systems does with happen with?

macOS

Notes

No response

[Bug]: Trait HasUploadingMessage not found

What happened?

error show Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found

How to reproduce the bug

i am create new laravel and filament project and implement image optimizer, and this is the error if i access the page that using FileUpload Component

Package Version

1.3.1

PHP Version

8.2.0

Laravel Version

10

Which operating systems does with happen with?

Windows

Notes

No response

It's not public on S3

What happened?

FileUpload::make('image')
->label(__('fields.Image'))
->acceptedFileTypes(['image/jpeg', 'image/png'])
->visibility('public')
->optimize('webp')
->downloadable()
->previewable()
->openable(),

It's not going to S3 with the public. should do something like this:
Storage::put($this->record->image, Storage::get($this->record->image), 'public');

How to reproduce the bug

.

Package Version

1.3

PHP Version

8.2

Laravel Version

10.43

Which operating systems does with happen with?

macOS

Notes

No response

Problem with S3 and livewire-tmp folder

What happened?

Getting this error when i add ->optimize('webp') to my FileUploads. and submit a form.
"Unable to find file (livewire-tmp/jeVtd41JPHzi9vyTyczpRHsiPit38g-metadW50aXRsZWQgKDI5IG9mIDMwKS5qcGc=-.jpg)."

From Livewire documentation:
"Livewire stores temporary files in a non-public directory as previously mentioned, therefore, there's no simple way to expose a temporary, public URL to your users for image previewing. If you've configured Livewire to use S3 for temporary file storage, calling ->temporaryUrl() will generate a temporary, signed URL from S3 directly so that you don't hit your Laravel app server for this preview at all."

My bucket is accessible from the internet and works normally.
However, when I inspect the file permissions inside the livewire-tmp folder, those are not readable from internet. The bucket however is correctly configured, inside my non-temporary folders all uploads are public. Im not sure if its a Livewire issue (or feature), im pretty sure the bucket and permissions are correct. If the tmp files cannot be read, could this be the reason why its throwing the error?

Thanks!

How to reproduce the bug

.env file:
FILESYSTEM_DISK=s3
FILAMENT_FILESYSTEM_DISK=s3

plus your AWS credentials.

In resource form schema, simply:
Forms\Components\FileUpload::make('main_image')
->label(__('Main Image'))
->image()
->directory('images')
->required()
->maxSize(2048)
->optimize('webp') // < throws exception
->visibility('public')
->downloadable()
->previewable()
->openable()

When submitting this exception appears:
Unable to find file (livewire-tmp/jeVtd41JPHzi9vyTyczpRHsiPit38g-metadW50aXRsZWQgKDI5IG9mIDMwKS5qcGc=-.jpg).

(The file is present in livewire-tmp/ inside the bucket but cannot be read)

Package Version

latest

PHP Version

8.3.1

Laravel Version

10.48.4

Which operating systems does with happen with?

Windows

Notes

No response

Trait not found

What happened?

When I use the optimize option I get the error Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found.
The trait is not in \vendor\filament\forms\src\Concerns. When I put on comment 'use Concerns\HasUploadingMessage;' it's working fine. Version error?

How to reproduce the bug

Make a Filament form with Forms\Components\SpatieMediaLibraryFileUpload::make('images')
->image()->imageEditor()->optimize('webp')

Package Version

joshembling/image-optimizer 1.4.0 + Filament 3.1.47

PHP Version

8.2.15

Laravel Version

10.48

Which operating systems does with happen with?

Windows

Notes

No response

[Bug]: Unsupported image type image/svg+xml

What happened?

When i try to upload an svg, the GD driver throws this exeption:
Intervention\Image\Exception\NotReadableException: Unsupported image type image/svg+xml.
Is there any way to skip optimization just for this file format?
Thanks!

How to reproduce the bug

When i upload an *.svg file, the Intervention\Image\Exception\NotReadableException exeption occurs.

Package Version

1.4.0

PHP Version

8.3.0

Laravel Version

11.0

Which operating systems does with happen with?

Linux

Notes

No response

[Bug]: AfterStateUpdated not available for every other Fileupload

What happened?

I tried to use the Filament Import Action and after hours of research i found out, that with this plugin installed every "afterStateUpadated" funtion for any FileUpload is not accessible anymore.
Can you please add some functionality so that the afterStateUpdated is not overwritten by default.
For Fileuploads like csv or anything else it makes no sense at all.

How to reproduce the bug

Install the Plugin, create a ImportAction and try to import.

Package Version

1.3.1

PHP Version

8.3

Laravel Version

10.45

Which operating systems does with happen with?

macOS

Notes

No response

[Bug]: Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found

What happened?

When I tried to install the plugins to existing filament project using composer

composer require joshembling/image-optimizer

I've got error below

PHP Fatal error:  Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found in /pathToProject/vendor/joshembling/image-optimizer/src/Components/BaseFileUpload.php on line 22

   Symfony\Component\ErrorHandler\Error\FatalError 

  Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found

  at vendor/joshembling/image-optimizer/src/Components/BaseFileUpload.php:22
     18โ–• use League\Flysystem\UnableToCheckFileExistence;
     19โ–• use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
     20โ–• use Throwable;
     21โ–• 
  โžœ  22โ–• class BaseFileUpload extends Field
     23โ–• {
     24โ–•     use Concerns\HasUploadingMessage;
     25โ–• 
     26โ–•     /**


   Whoops\Exception\ErrorException 

  Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found

  at vendor/joshembling/image-optimizer/src/Components/BaseFileUpload.php:22
     18โ–• use League\Flysystem\UnableToCheckFileExistence;
     19โ–• use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
     20โ–• use Throwable;
     21โ–• 
  โžœ  22โ–• class BaseFileUpload extends Field
     23โ–• {
     24โ–•     use Concerns\HasUploadingMessage;
     25โ–• 
     26โ–•     /**

      +1 vendor frames 

  2   [internal]:0
      Whoops\Run::handleShutdown()

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

How to reproduce the bug

install the package from terminal to existing filament project

composer require joshembling/image-optimizer

Package Version

1.3.0

PHP Version

8.2.2

Laravel Version

10.43.0

Which operating systems does with happen with?

macOS

Notes

my composer.json

"require": {
        "php": "^8.1",
        "awcodes/filament-table-repeater": "^2.0",
        "awcodes/filament-tiptap-editor": "^3.0",
        "aymanalhattami/filament-page-with-sidebar": "^2.4",
        "bezhansalleh/filament-shield": "^3.1",
        "codewithdennis/filament-select-tree": "^3.1",
        "darryldecode/cart": "^4.2",
        "dasundev/livewire-dropzone": "^1.0",
        "eightynine/filament-excel-import": "^3.0",
        "erlandmuchasaj/laravel-gzip": "^1.0",
        "filament/filament": "^3.0-stable",
        "filament/spatie-laravel-media-library-plugin": "^3.0",
        "filament/spatie-laravel-settings-plugin": "^3.0",
        "filament/spatie-laravel-tags-plugin": "^3.0",
        "filament/spatie-laravel-translatable-plugin": "^3.0",
        "flowframe/laravel-trend": "^0.1.1",
        "guzzlehttp/guzzle": "^7.2",
        "jenssegers/agent": "^2.6",
        "joshembling/image-optimizer": "*",
        "laravel/framework": "^10.10",
        "laravel/horizon": "^5.21",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8",
        "laraveldaily/laravel-invoices": "^3.3",
        "league/flysystem-aws-s3-v3": "^3.21",
        "predis/predis": "^2.2",
        "pxlrbt/filament-excel": "^2.1",
        "ralphjsmit/livewire-urls": "^1.3",
        "saade/filament-adjacency-list": "^3.1",
        "sebastiansulinski/laravel-currency": "^3.2",
        "spatie/image": "^2.2",
        "squirephp/countries-en": "^3.3",
        "squirephp/currencies-en": "^3.3",
        "z3d0x/filament-fabricator": "^2.0",
        "z3d0x/filament-logger": "^0.6.1"
    },

Laravel 11 support?

What happened?

Laravel 11 support?

How to reproduce the bug

No Laravel 11 support.

Package Version

latest

PHP Version

8.3

Laravel Version

11

Which operating systems does with happen with?

No response

Notes

No response

[Bug]: failed when composer require joshembling/image-optimizer Laravel 11

What happened?

i cannot use composer require joshembling/image-optimizer with error
joshembling/image-optimizer[v1.0.0, ..., v1.3.1] require illuminate/contracts ^10.0 -> found illuminate/contracts[v10.0.0, ..., v10.48.2] but these were not loaded, likely because it conflicts with another require.
and
Root composer.json requires joshembling/image-optimizer * -> satisfiable by joshembling/image-optimizer[v1.0.0, ..., v1.3.1].

How to reproduce the bug

i cannot use composer require joshembling/image-optimizer with error
joshembling/image-optimizer[v1.0.0, ..., v1.3.1] require illuminate/contracts ^10.0 -> found illuminate/contracts[v10.0.0, ..., v10.48.2] but these were not loaded, likely because it conflicts with another require.
and
Root composer.json requires joshembling/image-optimizer * -> satisfiable by joshembling/image-optimizer[v1.0.0, ..., v1.3.1].

Package Version

1.3.1

PHP Version

8.3

Laravel Version

11

Which operating systems does with happen with?

Windows

Notes

No response

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.