Welcome Guest, Not a member yet? Register   Sign In
Image Manipulation Class - Resize Original AND Create Thumb???
#5

[eluser]Unknown[/eluser]
[quote author="Muppit" date="1216092518"]Well after much head scratching here's my solution to this problem:

Code:
$this->load->library('image_lib');

//[ THUMB IMAGE ]
$img_config_0['image_library'] = 'GD';
$img_config_0['source_image'] = '../images/portfolio/' . $thisFile;
$img_config_0['maintain_ratio'] = TRUE;
$img_config_0['width'] = 200;
$img_config_0['height'] = 200;    
$img_config_0['create_thumb'] = TRUE;
                            
//[ MAIN IMAGE ]
$img_config_1['image_library'] = 'GD';
$img_config_1['source_image'] = '../images/portfolio/' . $thisFile;
$img_config_1['maintain_ratio'] = TRUE;
$img_config_1['width'] = 1000;
$img_config_1['height'] = 1000;
$img_config_1['create_thumb'] = FALSE;
                    
for($i=0;$i<2;$i++){              eval("\$this->image_lib->initialize(\$img_config_".$i.");");
if($this->image_lib->resize()){
echo "Success";                                
}else{
echo "Failed." .$i . $this->image_lib->display_errors();
}
}

Seems to be the fastest way of doing things. It will iterate through twice, each time loading in the right config array, of which the first one will generate a thumb from the specified image, and the second, resize that original image.

Hope it helps anyone having the same issue.[/quote]

Thanks! Simple but efficient solution!


Messages In This Thread
Image Manipulation Class - Resize Original AND Create Thumb??? - by El Forum - 10-24-2010, 03:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB