Welcome Guest, Not a member yet? Register   Sign In
how to resize .bmp image using codeigniter
#1

[eluser]Irshad Sheikh[/eluser]
Hi,
I have only problem with .bmp image while resizing using codeigniter.
It resizes other images like(.jpg,.png,.gif)

Can anyone tell me how to resize .bmg image.

My code
Quote: $config['upload_path'] = $path.'/user_images/large_images/';
$config['allowed_types'] = 'gif|jpg|png|bmp';
$config['max_size']='102400';
/* $config['max_width'] = '4024';
$config['max_height']= '4024';*/
$config['max_width'] = '60000';
$config['max_height']= '60000';
$this->load->library('upload', $config);
$this->upload->do_upload();
$data = array('upload_data' => $this->upload->data());

$imageWidth = $data['upload_data']['image_width'];
$imageHeight = $data['upload_data']['image_height'];

$config['image_library'] = 'gd2';
$config['source_image'] = $path.'/user_images/large_images/'.$data['upload_data']['file_name'];
$removefilename = $config['source_image'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
/*$config['width'] = 128 ;
$config['height'] = 96; */
if($imageWidth >'128' || $imageHeight >'96')
{
$resizethumWidth = 128;
$resizethumHeight = 96;
}
else
{
$resizethumWidth = $imageWidth;
$resizethumWidth = $imageHeight;
}
$config['width'] = $resizethumWidth ;
$config['height'] = $resizethumWidth;
$config['new_image'] = $path.'/user_images/thumbs/';
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
/*upload user_image*/
$config['image_library'] = 'gd2';
$config['source_image'] = $path.'/user_images/large_images/'.$data['upload_data']['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
if($imageWidth >'640' || $imageHeight >'424')
{
$resizeWidth = 640;
$resizeHeight = 424;
}
else
{
$resizeWidth = $imageWidth;
$resizeHeight = $imageHeight;
}
/* $config['width'] = 640 ;
$config['height'] = 424; */
$config['width'] = $resizeWidth ;
$config['height'] = $resizeHeight;
//$config['master_dim'] = 'width';
$config['new_image'] = $path.'/user_images/';
$this->image_lib->initialize($config);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();

Thanks in advance.
#2

[eluser]BrianDHall[/eluser]
The GD image manipulation library, which most people use and is the default for PHP, does not support bmp. You'll want to google "php resize bmp" as there are various people who've created functions that may or may not work for you.

ImageMagick doesn't support BMP by default either, so you'll just need to use some class or function available 'out there' to deal with BMP files.




Theme © iAndrew 2016 - Forum software by © MyBB