[eluser]John_Betong[/eluser]
[quote author="alexdemers" date="1254963088"]Just tried that, I didn't work at all. I'm starting to give up on this...[/quote]
http://johns-jokes.com/c_rabbit/
Check out the above link:
Here is the code:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
// require APPPATH .'libraries/MY_skyhook.php';
class C_rabbit extends Controller
{
protected $filename, $fullpath;
//==============================================================
//==============================================================
function __construct()
{
parent::__construct();
}
//==============================================================
//
// accepts new parameters
// returns new configuration
//
//==============================================================
function _image_set($width)
{
// set the thumbnail parameters
$thumb_config['image_library'] = 'gd2';
$thumb_config['source_image'] = $this->fullpath .'/' .$this->filename;
$thumb_config['create_thumb'] = true;
$thumb_config['maintain_ratio'] = true;
$thumb_config['new_image'] = $this->filename;
$thumb_config['quality'] = 64;
$thumb_config['height'] = 48;
$thumb_config['master_dim'] = 'width';
$thumb_config['width'] = $width ;
$thumb_config['thumb_marker'] = '_' .$width;
// call the library and create thumbnail
$this->load->library('image_lib');
$this->image_lib->clear();
$this->image_lib->initialize($thumb_config);
if (! $this->image_lib->resize())
{
echo $this->image_lib->display_errors();
}
// display the results
$style = "
border:dotted 1px #f00;
padding:0.42em;
text-align:center;
margin:2em auto;
width:" .$width .'px';
$new_img = str_replace('.jpg', $thumb_config['thumb_marker'], $this->filename)
. '.jpg';
$result = "<img >fullpath .'/' .$new_img ."' style='$style' alt='rabbit' /><br />";
return $result;
}
//==============================================================
//
//
//
//==============================================================
function index()
{
$this->fullpath = APPPATH .'img';
$this->filename = 'rabbit_shadow.jpg';
$style = '
background:#cfc none; color:#00f;
width:42%; margin:0.42em auto;
text-align:center
';
$ci_post = 'http://ellislab.com/forums/viewthread/131042/#648306';
$link = "<a href='" .$ci_post ."'>" .$ci_post .'</a>';
echo "<div style='width:88%; margin:0 auto;text-align:center'>";
echo "<fieldset style='$style'><legend>" .$link .'</legend>';
$width = 48;
echo $this->_image_set($width * 1);
echo $this->_image_set($width * 2);
echo $this->_image_set($width * 3);
echo '</fieldset>';
require APPPATH . 'views/adverts/_google_728x15.php';
echo '</div>';
}//endfunc
}//endclass