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.
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
You need to define the basic settings for your image as an array for the scrip to process:
<?php
$settings = array('w'=>300);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />
<?php
$settings = array('w'=>300, 'h'=>300);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />
<?php
$settings = array('w'=>300, 'h'=>300, 'canvas-color'=>'#ff0000');
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />
<?php
$settings = array('w'=>300, 'h'=>300, 'crop'=> true);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />
<?php
$settings = array('w'=>300, 'h'=>300, 'scale'=> true);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />
<?php
$settings = array('w'=>300, 'h'=>300);
?>
<img src='<?=resize('REMOTE_ADDR',$settings)?>' border='0' />
<?php
$settings = array('w'=>300, 'h'=>300, 'compress'=>true);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />
<?php
$settings = array('w'=>300, 'h'=>300, 'compress'=>true, 'compression'=>70);
?>
<img src='<?=resize($IMG_PATH,$settings)?>' border='0' />
Forked By Whizzzkid
Original Source Wes