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

TinyPNG integration #8

Closed
jessedobbelaere opened this Issue Jul 4, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@jessedobbelaere

jessedobbelaere commented Jul 4, 2017

This might be a bit too soon, but wanted to check if it's a good idea to integrate external services too. Let's say you don't have the necessary optimizers installed on the system, but you can still have the option to add your api key and let TinyPNG/TinyJPG optimize the images.

I'm currently using their developer api in a CMS image optimization module I wrote, but would love to swap the custom code out by your library so I can also support the other system optimizers if there are any on the system, and I believe many others would benefit from TinyPNG too.

With TinyPNG you get 500 images for free which is plenty for most of my use cases (and other users) + They do a really good job on compression (and can even crop/resize and do area-of-interest detection but that's not the goal of this package).

@freekmurze

This comment has been minimized.

Show comment
Hide comment
@freekmurze

freekmurze Jul 4, 2017

Member

Thanks for your suggestion. My aim for this package is that it requires zero setup (apart from the installation of some binaries) and is hassle free.

External services are a bit more complicated to work with:

  • they need to be setup (API key is needed)
  • they could cause significant slowdowns (image big images being uploaded over a slow connection to the service)
  • the external service may be down

So I'm going to hold of including such optimizers by default for now.

What you could do is create a separate package that handles optimization with TinyPng. It could contain a class that implements Spatie\ImageOptimizer\Optimizer. More info on that here: https://github.com/spatie/image-optimizer#writing-a-custom-optimizers

If you do that, I would probably reference your package in the readme of this one.

Member

freekmurze commented Jul 4, 2017

Thanks for your suggestion. My aim for this package is that it requires zero setup (apart from the installation of some binaries) and is hassle free.

External services are a bit more complicated to work with:

  • they need to be setup (API key is needed)
  • they could cause significant slowdowns (image big images being uploaded over a slow connection to the service)
  • the external service may be down

So I'm going to hold of including such optimizers by default for now.

What you could do is create a separate package that handles optimization with TinyPng. It could contain a class that implements Spatie\ImageOptimizer\Optimizer. More info on that here: https://github.com/spatie/image-optimizer#writing-a-custom-optimizers

If you do that, I would probably reference your package in the readme of this one.

@freekmurze

This comment has been minimized.

Show comment
Hide comment
@freekmurze

freekmurze Jul 4, 2017

Member

Closing this for now, but if you have any questions or remarks, feel free to reopen.

Member

freekmurze commented Jul 4, 2017

Closing this for now, but if you have any questions or remarks, feel free to reopen.

@freekmurze freekmurze closed this Jul 4, 2017

@jessedobbelaere

This comment has been minimized.

Show comment
Hide comment
@jessedobbelaere

jessedobbelaere Jul 6, 2017

Ok thanks! I'll try making a custom optimizer library when I start the rewrite of my CMS module. I really like their compression rate, and although being a lossy compression, the compression not visible.

There's the aspect of dealing with the API key, the limit of 500 images for a free account, and service possibly being down but depends on the project if you can afford having that. If down, I can even fall back on the system optimizers 🤔

E.g. the image from the readme (547kB)
The image after TinyJPG (238.5 KB, -56%)

68747470733a2f2f7370617469652e6769746875622e696f2f696d6167652d6f7074696d697a65722f6578616d706c65732f696d6167652e6a7067 1

jessedobbelaere commented Jul 6, 2017

Ok thanks! I'll try making a custom optimizer library when I start the rewrite of my CMS module. I really like their compression rate, and although being a lossy compression, the compression not visible.

There's the aspect of dealing with the API key, the limit of 500 images for a free account, and service possibly being down but depends on the project if you can afford having that. If down, I can even fall back on the system optimizers 🤔

E.g. the image from the readme (547kB)
The image after TinyJPG (238.5 KB, -56%)

68747470733a2f2f7370617469652e6769746875622e696f2f696d6167652d6f7074696d697a65722f6578616d706c65732f696d6167652e6a7067 1

@freekmurze

This comment has been minimized.

Show comment
Hide comment
@freekmurze

freekmurze Jul 6, 2017

Member

That's a pretty good result.

It would be really awesome if that driver would just work in the current setup of this package (aka that it can be run from the command line).

Looking forward to your work on this.

Member

freekmurze commented Jul 6, 2017

That's a pretty good result.

It would be really awesome if that driver would just work in the current setup of this package (aka that it can be run from the command line).

Looking forward to your work on this.

@jeroendesloovere

This comment has been minimized.

Show comment
Hide comment
@jeroendesloovere

jeroendesloovere Sep 28, 2017

Would indeed be a nice module for our Fork CMS.

jeroendesloovere commented Sep 28, 2017

Would indeed be a nice module for our Fork CMS.

@fiinix

This comment has been minimized.

Show comment
Hide comment
@fiinix

fiinix Jul 26, 2018

Hi, I know this is an older issue but I just wanted to bring up that TinyPNG uses pngquant as its main optimization library, which this already has

fiinix commented Jul 26, 2018

Hi, I know this is an older issue but I just wanted to bring up that TinyPNG uses pngquant as its main optimization library, which this already has

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment