Giter VIP home page Giter VIP logo

Comments (16)

toy avatar toy commented on May 28, 2024

image_optim is not the fastest thing (for png files) to run so I am not sure about running every time during deployment, it is better to optimize images before putting them into app repository. Though this needs to be checked.
Also I am really low on time, so don't hesitate if you have time and you are ready to do this :)

from image_optim.

botandrose avatar botandrose commented on May 28, 2024

Hi, guys, I really like the idea of replacing the core of sprockets-image_compressor with image_optim, but there would be one big regression: Image_optim won't currently work on Heroku because they don't have the binaries installed on their servers. I've statically compiled Heroku-friendly pngcrush and jpegoptim binaries and vendored them into sprockets-image_compressor to get around this issue. @toy, what are the odds of something similar happening here?

P.S. I'm running sprockets-image_compressor on deployment on about a dozen sites, and while not blazing fast, the overall asset compilation speed is acceptable.

from image_optim.

toy avatar toy commented on May 28, 2024

It may be a better idea to create separate gem with statically compiled binaries per platform and setting default_bin for each worker, otherwise image_optim will be a heavy gem. There is a problem with pngout as it can not be redistributed «without consent and agreement of creator».
It may be better to tune settings of compressors, as now they are making process very slow gaining few extra percents of compression.
Just to mention — I already used image_optim for paperclip post processor and it works very well there.

from image_optim.

toy avatar toy commented on May 28, 2024

@botandrose: just to be sure that you read previous one

from image_optim.

kristianmandrup avatar kristianmandrup commented on May 28, 2024

Thanks guys. Good discussion and nice points. Not sure what the outvome will be but hopefully someone wilvome up with an even better solution integrating all these nice solutions while still ensuring good performance etc.

from image_optim.

feliperaul avatar feliperaul commented on May 28, 2024

Guys, while your thrilling effort doesn't take off, how do you suggest setting up a nice integration of image_optim with a production rails app ?

What about not running every time during deploy as an asset preprocessor, but maybe every time AFTER deploy ? So deploy doesn't take forever and you leave the script running after deploy is finished ?

from image_optim.

mooktakim avatar mooktakim commented on May 28, 2024

For those that came here after googling (like me).
I have created a bin gem that allows you to run image_optim on heroku:
https://github.com/mooktakim/image_optim_bin

from image_optim.

toy avatar toy commented on May 28, 2024

Creating sprocket preprocessor appeared to be very simple, checkout rails branch, especially: https://github.com/toy/image_optim/blob/rails/lib/image_optim/railtie.rb

from image_optim.

kristianmandrup avatar kristianmandrup commented on May 28, 2024

Cool 👍

from image_optim.

toy avatar toy commented on May 28, 2024

@mooktakim I've finally managed to create bin pack for image_optimimage_optim_pack. Working on heroku — https://iopack.herokuapp.com/.
Pack doesn't include svgo and I am not sure that it will be easy to pack it and doesn't include pngout due to its license. I'll try to contact Ardfry Imaging, LLC about including it. Could you please tell me if you've got an agreement with them and if it was easy?

from image_optim.

mooktakim avatar mooktakim commented on May 28, 2024

Hey @toy,
I didn't get in contact with them. I was just using it for myself. I'm not sure how easy it would be to get permission to include it.

from image_optim.

ghostropic avatar ghostropic commented on May 28, 2024

Hey @toy
I'm attempting to get image_optim_pack pushed to Heroku. I tried using @mooktakim's build pack but fails while precompiling assets. Do you know of any other methods of getting your bin pack to build on Heroku?

from image_optim.

toy avatar toy commented on May 28, 2024

@ghostropic
Do I understand right that image_optim_pack itself also doesn't work? Can you share errors?
One way to get binaries is to build them using Makefile from that gem.
Maybe it is also better to move this to a separate issue for that project.

from image_optim.

ghostropic avatar ghostropic commented on May 28, 2024

@toy Sorry for the confusion. Image_optim_pack does work locally, but isn't useful to me unless I can get it working on Heroku, so I thought i'd ask if you had any leads on a build pack. I suppose my only option though is to learn to write my own.

from image_optim.

toy avatar toy commented on May 28, 2024

@ghostropic Ah no, I understood you, but my questions were confusing. As I understand heroku gives you ubuntu servers and image_optim_pack should work on ubuntu. So does it not work on heroku and which errors do you get? And one way to get binaries is to use make on machine you are targeting, so on heroku instance.

from image_optim.

toy avatar toy commented on May 28, 2024

@ghostropic As there was already a heroku app to check versions, I've added there a very basic upload with optimisation for checking if everything works, and it seems it does: https://iopack.herokuapp.com/

from image_optim.

Related Issues (20)

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.