user1516976
user1516976

Reputation: 35

Codeigniter Image Resize giving wrong output

I am using Codeigniter 2.0.2 I want image Dimension 60x70 This Code not giving any error and generating image which width = 60 and height = 44 What is problem ?

        $config['source_image'] = $preview_path;
        $config['new_image'] = $dir_small_prev.$file_namee;
        $config['maintain_ratio'] = TRUE;
        $config['master_dim'] = 'width';
        $config['width'] = 60;
        $config['height'] = 70;
        $config['image_library'] = 'gd2';
        $config['quality'] = 100;
        $this->image_lib->initialize($config);
        if ( ! $this->image_lib->resize()){
        echo $this->image_lib->display_errors();

Upvotes: 0

Views: 565

Answers (1)

Paul Dessert
Paul Dessert

Reputation: 6389

$config['maintain_ratio'] = TRUE; Set this to FALSE

You'll skew your image, but you'll get the dimensions you're looking for

Upvotes: 2

Related Questions