All Projects → artisansweb → image-optimizer

artisansweb / image-optimizer

Licence: MIT license
Image optimization using PHP

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to image-optimizer

Imagemin
[Unmaintained] Minify images seamlessly
Stars: ✭ 4,948 (+17571.43%)
Mutual labels:  jpg, png, gif
QuickImageFX
Simplifying image manipulation using GDI, Graphics32, OpenCV or Vampyre Imaging libraries
Stars: ✭ 41 (+46.43%)
Mutual labels:  jpg, png, gif
Ccapture.js
A library to capture canvas-based animations at a fixed framerate
Stars: ✭ 2,836 (+10028.57%)
Mutual labels:  jpg, png, gif
Image Optimizer
Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.
Stars: ✭ 785 (+2703.57%)
Mutual labels:  jpg, png, gif
wordpress-plugin
Speed up your WordPress website. Optimize your JPEG and PNG images automatically with TinyPNG.
Stars: ✭ 78 (+178.57%)
Mutual labels:  jpg, png
alfred-imagemin
Alfred workflow - Minify images with Imagemin
Stars: ✭ 29 (+3.57%)
Mutual labels:  png, gif
save-html-as-image
Download the HTML (DOM) to Image (JPG, PNG)
Stars: ✭ 26 (-7.14%)
Mutual labels:  jpg, png
3dn-bip
A Python library for Blender addons. Blazingly fast preview loads in Blender. Images of arbitrary size. bpy.utils.previews drop-in replacement.
Stars: ✭ 41 (+46.43%)
Mutual labels:  jpg, png
Imageviewer
HDR, PFM, DDS, KTX, EXR, PNG, JPG, BMP image viewer and manipulator
Stars: ✭ 71 (+153.57%)
Mutual labels:  jpg, png
oculante
A minimalistic crossplatform image viewer written in rust
Stars: ✭ 169 (+503.57%)
Mutual labels:  jpg, png
gfxprim
Open-source modular 2D bitmap graphics library with emphasis on speed and correctness.
Stars: ✭ 32 (+14.29%)
Mutual labels:  png, gif
Precomp Cpp
Precomp, C++ version - further compress already compressed files
Stars: ✭ 250 (+792.86%)
Mutual labels:  jpg, gif
sail
The missing small and fast image decoding library for humans (not for machines) ⛵ https://sail.software
Stars: ✭ 206 (+635.71%)
Mutual labels:  png, gif
HEIF
Mac OS X: Convert any image to HEIF/HEIC format
Stars: ✭ 58 (+107.14%)
Mutual labels:  jpg, png
Gimage
A PHP library for easy image handling. 🖼
Stars: ✭ 148 (+428.57%)
Mutual labels:  jpg, png
xaringanBuilder
An R package for building xaringan slides into multiple outputs, including html, pdf, png, gif, pptx, and mp4.
Stars: ✭ 157 (+460.71%)
Mutual labels:  png, gif
StbSharp
C# port of the famous C framework
Stars: ✭ 62 (+121.43%)
Mutual labels:  png, gif
ee.Screen
Takes screenshots of web pages for the list of URLs. Various resolutions, multiple formats (JPG, PDF, PNG and TXT)
Stars: ✭ 19 (-32.14%)
Mutual labels:  jpg, png
tinypng-free
Use the upload api of tinypng's homeage to compress images
Stars: ✭ 29 (+3.57%)
Mutual labels:  jpg, png
Optimise Images
Batch image resizer, optimiser and profiler using ImageMagick convert, OptiPNG, JpegOptim and optional ZopfliPNG, Guetzli and MozJPEG.
Stars: ✭ 64 (+128.57%)
Mutual labels:  jpg, png

Image optimization using PHP

This library helps you to compress JPGs, PNGs, GIFs images on the fly. Apart from this package, you don't need to install any additional software or package to perform optimization task.

Installation

You can install the package via composer:

composer require artisansweb/image-optimizer

Under the hood, this package uses resmush.it service to compress the images. Alternatively, package using native PHP functions - imagecreatefromjpeg, imagecreatefrompng, imagecreatefromgif, imagejpeg.

Usage

This package is straight-forward to use. All you need to do is pass source path of your image.

use ArtisansWeb\Optimizer;

$img = new Optimizer();

$source = 'SOURCE_PATH_OF_IMAGE';
$img->optimize($source);

Above code will optimize the image and replace the original image with the optimized version.

Optionally, you can also pass destination path where optimized version will stored.

$source = 'SOURCE_PATH_OF_IMAGE';
$destination = 'DESTINATION_PATH_OF_IMAGE';
$img->optimize($source, $destination);

Recommeded way of using this code is on image upload. The user should optimize image on upload which will result in better performance.

Let's say you want to store optimized version in the 'images' folder. You can use the below code for this purpose.

<?php
require_once "vendor/autoload.php";

use ArtisansWeb\Optimizer;

if (isset($_POST['submit'])) {
    $img = new Optimizer();
    move_uploaded_file($_FILES['file']['tmp_name'], 'images/'.$_FILES['file']['name']);
    $img->optimize('images/'.$_FILES['file']['name']);
}
?>

<form method="post" enctype="multipart/form-data">
    <input type="file" name="file" />
    <input type="submit" name="submit" value="Submit" />
</form>

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].