Code Monkey home page Code Monkey logo

php-image-optimise's Introduction

PHP image optimiser

Utilising dropzonejs and ImageMagik a simple php solution to be able to easily optimise images

The use case of this was to be able to easily optimise images before uploading them to a website, to make sure they are small and snappy. Generated images for the website were ~3mb in size, and the website makes heavy use of images (e-commerce store) so having lots of large images isn't ideal. I was manually doing the optimisation, but figured if I made something I could host somewhere, the content editor could resize the images themselves!

This is really adapted to my needs. Images are always coming at the same size dimension and format What I am doing to the images:

  1. Resizing image to specified size (squared)
  2. Striping the image of any meta data
  3. Converting to JPEG
  4. setting quality of output to 85%
  5. Making the image a progressive jpeg

Doing these things is optimising the images from ~3mb in size down to 132kb (resizing to 1024x1024) and 37kb (resize to 512x512)

Installing

  • You will obviously need php, and php Imagick.
  • Ensure you have updated your upload limits in php.ini or .htaccess to allow for larger files

php-image-optimise's People

Contributors

mrwhale avatar

Watchers

 avatar  avatar

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.