Giter VIP home page Giter VIP logo

phpimageresize's Introduction

PHPImageResize Script

This is a beautiful scrip that will allow you to simply resize, compress and cache your images on the fly. The script is dynamic and flexible and is being updated continuously.

Using The Script

You just need to include a simple function file in your project and you are good to go. So you basically start by including the file in your project.

<?php require_once 'function.resize.php'; ?>

And create folder called cache - with writable permissions (777) and another folder inside cache called remote

Basic Resizing

You need to define the basic settings for your image as an array for the scrip to process:

Resizing by width/height:

<?php
	$settings = array('w'=>300);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />

Resizing By Width and Height

<?php
	$settings = array('w'=>300, 'h'=>300);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />

Resizing and giving a custom canvas color

<?php
	$settings = array('w'=>300, 'h'=>300, 'canvas-color'=>'#ff0000');
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />

Resizing by Cropping

<?php
	$settings = array('w'=>300, 'h'=>300, 'crop'=> true);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />

Scaling the image

<?php
	$settings = array('w'=>300, 'h'=>300, 'scale'=> true);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />

Resizing images from remote location

<?php
	$settings = array('w'=>300, 'h'=>300);
?>
<img src='<?=resize('REMOTE_ADDR',$settings)?>' border='0' />

Compressing Images to JPEG (lossy)

<?php
	$settings = array('w'=>300, 'h'=>300, 'compress'=>true);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />

Setting Compression Level (1-99)Low to High

<?php
	$settings = array('w'=>300, 'h'=>300, 'compress'=>true, 'compression'=>70);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />

Check Out The Example Here!

Forked By Whizzzkid

Original Source Wes

Cheers!...

phpimageresize's People

Contributors

wes avatar davidgoodwin avatar whizzzkid 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.