Welcome Guest, Not a member yet? Register   Sign In
image_lib resize doesn't work
#1

[eluser]flashingback[/eluser]
Hello,

I have some problem's with the image_lib library. It doesn't do anything actually.

This is the function I made:
Code:
function adjust_image($img){
        $this->load->library('image_lib');
        $config['image_library'] = 'GD';
        $config['source_image'] = base_url().'/images/'.$img.'.jpg';
        $config['create_thumb'] = TRUE;
        $config['maintain_ratio'] = TRUE;
        $config['width'] = 75;
        $config['height'] = 50;
        
        $this->load->library('image_lib', $config);
        
        $this->image_lib->resize();
        echo "<img src='".$config['source_image']."' />";
    }
#2

[eluser]Référencement Google[/eluser]
The only thing I see wrong here could be your path, try something like:

Code:
$config['source_image'] = './images/'.$img.'.jpg';
#3

[eluser]flashingback[/eluser]
I tried it but also didn't work.
#4

[eluser]Référencement Google[/eluser]
Oops, I saw now, you are loading 2 times the image library, shoot out the 1st load that you are doing and tell me what's going on. Also try to get errors so you can know what's happend:

Code:
if ( ! $this->image_lib->resize())
{
    echo $this->image_lib->display_errors();
}
#5

[eluser]flashingback[/eluser]
thx it works fine now




Theme © iAndrew 2016 - Forum software by © MyBB