Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]Image resize - not working without thumb
#11

[eluser]Zeeshan Rasool[/eluser]
Try this , hope it works

Code:
$config_image['image_library']     = 'gd2';
$config_image['source_image']      = './resources/images/team_images/'.$file_name;
$config_image['new_image']       = './resources/images/team_images/'.$file_name;

$config_image['create_thumb']     = FALSE;
$config_image['maintain_ratio']  = TRUE;
$config_image['width']          = 243;
$config_image['height']      = 360;

$this->load->library('image_lib',$config_image);
$this->image_lib->initialize($config_image);
$this->image_lib->resize();

keep going,
#12

[eluser]karloff[/eluser]
thanks guys, i managed to get it working with the folloing config

Code:
chmod('./images/projects/'.$_FILES['image']['name'], 0777);
            $config['image_library'] = 'gd2';
            $config['create_thumb'] = FALSE;
            $config['maintain_ratio'] = TRUE;
            
            $config['quality'] = 100;
            $config['width'] = 478;
            $config['height'] = 778;
            $config['master_dim'] = 'width';

            $config['source_image'] = './images/projects/'.$_FILES['image']['name'];
            $config['new_image']       = './images/projects/'.$_FILES['image']['name'];

            $this->load->library('image_lib');
            $this->image_lib->initialize($config);
#13

[eluser]slowgary[/eluser]
Where is $config_image['new_image'] being used? I don't think you need it as you're overwriting the original. Also, I couldn't find $config['overwrite'] in the user guide, are you sure that's necessary?
#14

[eluser]karloff[/eluser]
thank Gary, bit of a typo there... I've updated the code with what I'm using

thanks again
#15

[eluser]slowgary[/eluser]
Just to nitpick one more time, I think $config['new_image'] is unnecessary as you're manipulating the existing image. Same with 'image_library', 'create_thumb', 'maintain_ratio' since the values you've specified are already the default value.

You may be able to omit 'height' and 'master_dim' as well since you're not cropping. Basically you're telling it to always resize the width to 478, and let the height be what it needs to be to respect the original aspect ratio. But since 'maintain_ratio' is TRUE by default, all you really need to do is specify your preferred width (at least I think that should work).

So as far as I can tell, the following code would do the same as what you have, but with a few less lines:
Code:
$config['quality'] = 100;
$config['width'] = 478;
$config['source_image'] = './images/projects/'.$_FILES['image']['name'];
$this->load->library('image_lib', $config);

chmod('./images/projects/'.$_FILES['image']['name'], 0777);
$this->image_lib->resize();
#16

[eluser]karloff[/eluser]
thanks, I just tried that an yes... you are right. thanks




Theme © iAndrew 2016 - Forum software by © MyBB