ainsleyclark / squidge

🖼️ A FREE Wordpress Plugin to compress and convert images using cwebp, jpegoptim and optipng.
GNU General Public License v3.0
42 stars 8 forks source link

Can't run squidge command #12

Open supersonic2k22 opened 2 years ago

supersonic2k22 commented 2 years ago

Error: 'squidge' is not a registered wp command. See 'wp help' for available commands.

supersonic2k22 commented 2 years ago

I solved this problem. You have an error in the code. In Linux filename that is case sensitive. Please in the main plugin file, require, changing the name of the file to solve this error. From commands.php to Commands.php

ainsleyclark commented 2 years ago

Hi @karbivskij Thanks for flagging this, I will roll it out in the next update. All the best.

myedgy commented 1 year ago

@supersonic2k22 How do you run this? I seems not that you can optimize the images in the wordpress dashboard right?

You need to do this via putty? Can you assist me please

My wordpress install path is /home/admin/domains/mydomain.com/public_html/

wp squidge run path=home/admin/domains/mydomain.com

Warning: No WordPress installation found. If the command 'squidge run path=home/admin/domains/mydomain.com' is in a plugin or theme, pass --path=path/to/wordpress. Error: 'squidge' is not a registered wp command. See 'wp help' for available commands.

supersonic2k22 commented 1 year ago

I'm not working for free and now I'm busy with another project.

myedgy commented 1 year ago

positive vibes your way, mate :)

supersonic2k22 commented 1 year ago

@myedgy I remember that in the plugin we have an error with font case. You can download my version of this plugin. If you need the support from me we can connect in telegram or another messenger. My edited version with few commits - https://github.com/supersonic2k22/squidge

supersonic2k22 commented 1 year ago

@myedgy In the original plugin, you need to change this lines 29-32 in file squidge.php from // Require CLI. if (file_exists(__DIR__ . '/cli/commands.php')) { require(__DIR__ . '/cli/commands.php'); } to // Require CLI. if (file_exists(__DIR__ . '/cli/Commands.php')) { require(__DIR__ . '/cli/Commands.php'); } @ainsleyclark please fix this error, I told you about it before. But plugin still not changed.

myedgy commented 1 year ago

@supersonic2k22 Roman, thank you so much!

Yes, this was still the issue! Now i can run it! Fack sake, i read about this, i thought it was fixed. I was searching for days already, why i couldn't run it.

I found the map with Commands.php and C was with a capital so i thought it was already fixed in the latest update.

@ainsleyclark are you still active? Because you have build an amazing plugin, one of its kind. Tried already a few CDN networks but they are all so freaking slow when loading the images. So i was looking for something to run on our own server.

myedgy commented 1 year ago

The conversions start, but when i check the upload folder i only can find .jpg.webp files and not .jpg.avif files ? Anyone has noticed this or is it working for you guys?

wp squidge run or wp squidge run --avif=true --quality=80 --optimization=o3

It starts in pcli

Processing image: b50d6840-ff0c-4daa-b052-cbf3a7033a10 WebP Conversion... AVIF Conversion... JPG Compression... PNG Compression... Success: Processed image: b50d6840-ff0c-4daa-b052-cbf3a7033a10

Also, I assume I had to add the content of the Functions.php file copy paste it in my child-themes functions.php

When I do wp squidge health I also notice to receive first these warnings:

Deprecated: Return type of Carbon_Fields\Pimple\Container::offsetExists($id) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/admin/domains/y.com/public_html/wp-content/plugins/squidge/vendor/htmlburger/carbon-fields/core/Pimple/Container.php on line 128 Deprecated: Return type of Carbon_Fields\Pimple\Container::offsetGet($id) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/admin/domains/y.com/public_html/wp-content/plugins/squidge/vendor/htmlburger/carbon-fields/core/Pimple/Container.php on line 93 Deprecated: Return type of Carbon_Fields\Pimple\Container::offsetSet($id, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/admin/domains/y.com/public_html/wp-content/plugins/squidge/vendor/htmlburger/carbon-fields/core/Pimple/Container.php on line 74 Deprecated: Return type of Carbon_Fields\Pimple\Container::offsetUnset($id) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/admin/domains/y.com/public_html/wp-content/plugins/squidge/vendor/htmlburger/carbon-fields/core/Pimple/Container.php on line 138

supersonic2k22 commented 1 year ago

@myedgy It is because your server does not has a library for converting to AVIF format. You need to install this library, please read the documentation of the plugin.

Please check this in admin dashboard of WordPress - image

myedgy commented 1 year ago

@supersonic2k22 the library is active since i installed the plugin, I had read this, and the plugin also said that I needed to install this library first. So I did on my debian 11 system.

Update the package index:

sudo apt-get update

Install libavif-dev deb package:

sudo apt-get install libavif-dev

image

supersonic2k22 commented 1 year ago

@myedgy look for an error, maybe the conversion parameters are incorrectly specified. I used before this plugin and for me it was worked. So maybe you have some error in code or environment.

myedgy commented 1 year ago

I'm trying to find the issue, and checking server logs if I maybe can find something. I'm running also on OpenLiteSpeed not sure if this could be a problem.

myedgy commented 1 year ago

@myedgy look for an error, maybe the conversion parameters are incorrectly specified. I used before this plugin and for me it was worked. So maybe you have some error in code or environment.

Did you find an other plugin that can convert images to webp and avif perhaps? Without the use of a third party where you need to have a CDN subscription to convert them.

supersonic2k22 commented 1 year ago

I'm trying to find the issue, and checking server logs if I maybe can find something. also, I recommended using the original plugin, because in my version can be errors, maybe I tested some things before.

myedgy commented 1 year ago

I will try the orignal, and upload the missing folders that I could find from the first release. @supersonic2k22 and I appreciated your time and your contribute in this.

ainsleyclark commented 1 year ago

Hi @supersonic2k22 @myedgy thanks for your comments with everything. I'll look into it in the coming weeks but would really appreciate any pull requests.

@supersonic2k22 will the pull request you opened fix above? Sorry just catching up appreciate the help.

myedgy commented 1 year ago

@ainsleyclark @supersonic2k22 In the logs i'm unable to find any issues. I will try tomorrow the original and upload the missing folders. Will try to create a pull request for that one.

supersonic2k22 commented 1 year ago

Hi @supersonic2k22 @myedgy thanks for your comments with everything. I'll look into it in the coming weeks but would really appreciate any pull requests.

@supersonic2k22 will the pull request you opened fix above? Sorry just catching up appreciate the help.

Hello, I added to my version - counter and changed the path to cli. @ainsleyclark You can try my version and fix some errors if you want. If you want to update the plugin with my support we can discuss it in direct messages. I have some ideas to improve the plugin.

ainsleyclark commented 1 year ago

@supersonic2k22 sounds great, my email is info@ainsleyclark.com

myedgy commented 1 year ago

would be cool!

Because in CLI it says convertion works..

AVIF Conversion... Squidge: [INFO] - Successfully converted to AVIF file: /home/admin/domains/x.com/public_html/wp-content/uploads/2022/12/Maserati-GranTurismo-1.jpg.avif Squidge: [INFO] - Successfully converted to AVIF file: /home/admin/domains/x.com/public_html/wp-content/uploads/2022/12/Maserati-GranTurismo-1-300x221.jpg.avif Squidge: [INFO] - Successfully converted to AVIF file: /home/admin/domains/x.com/public_html/wp-content/uploads/2022/12/Maserati-GranTurismo-1-1024x754.jpg.avif Squidge: [INFO] - Successfully converted to AVIF file: /home/admin/domains/x.com/public_html/wp-content/uploads/2022/12/Maserati-GranTurismo-1-150x150.jpg.avif Squidge: [INFO] - Successfully converted to AVIF file: /home/admin/domains/x.com/public_html/wp-content/uploads/2022/12/Maserati-GranTurismo-1-768x565.jpg.avif

But when i go to the folder via FTP i only see WEBP convertions.

myedgy commented 1 year ago

@supersonic2k22 Indeed if i try to run your version PUTTY freezes and in my server dashboard cpu load is 25 - max 35%

With the original it runs, everything. It also says it made .jpg.avif files however they are not made.. only webp.

If this plugin really works, it would be nice if you can select a folder. As i'm going to create media.mysite.com for all image uploads

https://frunction.com/2016/06/wordpress-serve-images-from-subdomain/