Welcome Guest, Not a member yet? Register   Sign In
Need Help : Image Library - resize image
#1

[eluser]Unknown[/eluser]
I want to resize Original image twice in a one function.

I have used following function, but it is not work

$config['upload_path'] = './journal_photos/';
$config['allowed_types'] = 'gif|jpg|png|bmp';
$config['max_size'] = '';
$config['max_width'] = '';
$config['max_height'] = '';
$this->load->library('upload',$config);
$this->upload->do_upload();
$temp=$this->upload->data();

if($temp['file_name'] != NULL)
{
$config['image_library'] = 'GD2';
$config['source_image'] = './journal_photos/'.$temp['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 100;
$config['height'] = 75;

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

$first = $this->image_lib->resize();



$config1['image_library'] = 'GD2';
$config1['source_image'] = './journal_photos/'.$temp['file_name'];
$config1['create_thumb'] = FALSE;
$config1['new_image'] = './journal_photos/new.jpeg';
$config1['maintain_ratio'] = TRUE;
$config1['width'] = 60;
$config1['height'] = 40;

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

$second = $this->image_lib->resize();

if (! $this->image_lib->resize())
{
echo $this->image_lib->display_errors();
}

}//if

Please suggest solution.
#2

[eluser]Chris Newton[/eluser]
In order for the image class to be allowed to do any processing, the folder containing the image files must have file permissions of 777. Is your folder permissions set to 777?

You may also want to use: $this->image_lib->clear(); between images.

After uploading an image, you may need to supply the full server path to the image: (e.g. /path/to/website/uploads/image.jpg) rather than using a relative path.




Theme © iAndrew 2016 - Forum software by © MyBB