Showing posts with label codeigniter. Show all posts
Showing posts with label codeigniter. Show all posts

Thursday, May 6, 2010

Php-codeigniter creating thumbnails

I have created a library function


function image_resize($data)
{
$this->CI =& get_instance();
$error="";
$config['image_library'] = 'gd2';
$config['source_image'] = $data['source_image'];
$config['new_image']= $data['new_image'];
$config['create_thumb'] =$data['create_thumb'];
$config['thumb_marker'] = $data['thumb_marker'];

$config['maintain_ratio'] = TRUE;
$config['width'] = $data['width'];
$config['height'] = $data['height'];

$this->CI->load->library('image_lib');
$this->CI->image_lib->clear();
$this->CI->image_lib->initialize($config);
if ( ! $this->CI->image_lib->resize())
{
$error= $this->CI->image_lib->display_errors();
}

Tuesday, March 16, 2010

Php - How to remove index.php from codeigniter url

This is the best way to get ride of index.php from your website's url which is build using codeigniter framework.


RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]



copy and paste the above code in  .htaccess file in your website root.Ensure that no extra  whitspaces are included before or after the codes.

In config.php you can replace

$config['index_page'] = "index.php"; 
with this
$config['index_page'] = "";

Happy coding...