Code Monkey home page Code Monkey logo

image-compress-library-for-codeigniter's Introduction

Image Compress for CodeIgniter

What is this repository for?

This is an Image Compression Library for CodeIgniter. This library compressing image to smaller size but not reduce the image quality. This library supporting an .gif animation image and created the thumbnail.

Requirement

  • PHP >= 5.4.0
  • PHP GD extension
  • CodeIgniter > 3.0.0

How do I get set up ?

Just copy and paste all files on your codeigniter application folder

How do I use ?

Provide the User with a set up this parameters on controller file

$setting['image_path'] = './media/temp/';
$setting['image_name'] = 'my_image.jpg';
$setting['compress_path'] = './media/';
$setting['jpg_compress_level'] = 5;
$setting['png_compress_level'] = 5;
$setting['create_thumb'] = TRUE;
$setting['width_thumb'] = 300;
$setting['height_thumb'] = 300;

After the User set up all parameters, run it

$this->load->library('imgcompressor', $setting);
$result = $this->imgcompressor->do_compress();

Cheat Sheet / Option

Parameter Default Available Description
image_path n/a n/a image uploading/source path
image_name n/a n/a image name
compress_path n/a n/a image after compressing path
jpg_compress_level 5 [0, 5] jpg compression level
png_compress_level 5 [0, 5] png compression level
create_thumb false true, false create thumb image or not
width_thumb 150 n/a (numeric) thumb width
height_thumb 150 n/a (numeric) thumb height

Output

$data = array(
	'original' => array(
		'name' => 'original.jpg',
		'image' => './media/temp/original.jpg',
		'type' => 'jpg,
		'width' => '1600',
		'height' => '1200',
		'size' => 925488
	),
	'compressed' => array(
		'name' => 'output.jpg',
		'image' => './media/output.jpg',
		'type' => 'jpg,
		'width' => '1600',
		'height' => '1200',
		'size' => 256190
	),
	'thumbnail' => array(
		'name' => 'output_thumb.jpg',
		'image' => './media/output_thumb.jpg',
		'type' => 'jpg,
		'width' => '300',
		'height' => '200',
		'size' => 56190
	)
);

Resources

image-compress-library-for-codeigniter's People

Contributors

we-pe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sdechevigne

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.