Welcome Guest, Not a member yet? Register   Sign In
Image Manupulation help
#1

[eluser]Unknown[/eluser]
I have planned to create thumbnails for the photos that I wpload . I am new to codeigniter so I couldn't create one. if anybody could help me Here is my code of the controller file
Code:
[quote]function __construct()

    {
        parent::__construct();
        $this->load->helper(array('form', 'url'));
        $this->gallery_path = realpath(APPPATH . '../images');
        $this->gallery_path_url = base_url().'images/';
        
        
            }
function index()
{
$this->load->view('gallery');
$config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size']    = '100';

        $config['max_width']  = '1024';
        $config['max_height']  = '768';

        $this->load->library('upload', $config);

if ( ! $this->upload->do_upload())
        {
            
        }
        else
        {
            $upload_data[] = $this->upload->data('full_path');                
        
            $this->thumb($upload_data);
  
        }
    }


function thumb($upload_data)
{
$config['source_img'] =  '$upload_data[file_path]';
$config['new_image'] = $this->gallery_path . '/thumbs';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;

$this->load->library('image_lib', $config);
if ( ! $this->image_lib->resize())
{
    echo $this->image_lib->display_errors();
}
else { echo "sucess";
}
}
}[/quote]

And here is my view file

Code:
[quote]<html>
<head>
<title>Upload Form</title>
</head>
<body>


<?php echo form_open_multipart('images');?>

<input type="file" name="userfile" size="20" />

<br /><br />

&lt;input type="submit" value="upload" /&gt;

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;[/quote]

Please help me ???
#2

[eluser]osci[/eluser]
In your index
Code:
$upload_data = $this->upload->data();

EDIT:
And since you took the time to put your code in quote tags, try next time to use code instead of quote tag. It doesn't translate tags and it highlights code too. Easier for all.




Theme © iAndrew 2016 - Forum software by © MyBB