Welcome Guest, Not a member yet? Register   Sign In
Resizing problem
#1

[eluser]simotho[/eluser]
Hello peps.
I have a little problem. My script upload the picture, but doesnt resize it.
My resizing code is:

Code:
$this->load->helper('file');
$this->load->library('image_lib');
$config['image_library'] = 'gd2';
$config['source_image'] = $image_data['full_path'];
$config['new_image'] = $this->gallery_path . "/thumbs";
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$this->image_lib->initialize($config);

$this->image_lib->resize();

I hope that somebody wants to help me, because its make me totally weird in my head after sitting with this problem in one hole day!!! Smile
#2

[eluser]michaeljdennis[/eluser]
$this->load->helper('file');

$config['image_library'] = 'gd2';
$config['source_image'] = $image_data['full_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);

$this->image_lib->resize();

Any luck with that?
#3

[eluser]simotho[/eluser]
No, i can upload the picture correct, but not resize it :/
#4

[eluser]JoostV[/eluser]
Does this create any output?
Code:
echo $this->image_lib->display_errors();
#5

[eluser]simotho[/eluser]
No, i have this code now uploading + resizing:

Code:
$config = array(
'allowed_types' => 'jpg|jpeg|gif|png',
'upload_path' => './uploads/',
'max_size' => 2000
);
        
$this->load->library('upload', $config);
$this->upload->do_upload();
$image_data = $this->upload->data();
        
$config = array(
    'source_image' => $image_data['full_path'],
    'new_image' => './uploads/thumbs',
    'maintain_ration' => true,
    'width' => 150,
    'height' => 100
);
        
$this->load->library('image_lib', $config);
$this->image_lib->resize();
        
echo $this->image_lib->display_errors();

But it only upload the picture, but not resize it...
#6

[eluser]simotho[/eluser]
Arrg, finally...
I replaced this code:

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

With:

$this->image_lib->initialize($config);

And now it's works perfect! Smile




Theme © iAndrew 2016 - Forum software by © MyBB