Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8810857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:13:14+00:00 2026-06-14T03:13:14+00:00

I want to resize image without image being distorted.For example if i have set

  • 0

I want to resize image without image being distorted.For example if i have set the image height to be 100 and width as 200.The image resized must be of 100 height and 200 width.In order to achieve that i want to crop that image instead of getting it distorted.

My config options:-

            $config['create_thumb'] = TRUE;
            $config['maintain_ratio'] = FALSE;
            $config['master_dim'] = 'auto';
            $config['width'] = 100;
            $config['height']= 100;

            $this->image_lib->initialize($config);
            $this->image_lib->resize();

Also is it possible without using any other library of image manipulation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:13:15+00:00Added an answer on June 14, 2026 at 3:13 am

    I have solved my problem. I had to re-sized my image and then crop it. Its a bit of long process anyways if you have a better than this please suggest.

    My code:

                //Resize Image
                $config = array();
                $config['image_library'] = 'gd2';
                $config['source_image'] = './assets/original/'.$image_name;
                $config['new_image'] = './assets/banner/'.$image_name;
                $config['create_thumb'] = FALSE;
                $config['maintain_ratio'] = TRUE;
                $config['master_dim']= 'width';
                $config['quality']  = '100';
                $config['width'] = 1260;
                $config['height']= 645;
                $this->image_lib->initialize($config);
                $this->image_lib->resize();
                // Crop Image
                $config = array();
                $config['image_library'] = 'gd2';
                $config['source_image'] = './assets/banner/'.$image_name;
                $config['new_image'] = './assets/banner/'.$image_name;
                $config['create_thumb'] = FALSE;
                $config['maintain_ratio'] = FALSE;
                $config['quality']  = '100';
                $config['x_axis'] = 0;
                $config['y_axis'] = 0;
                $config['width'] = 1260;
                $config['height']= 645;
                $this->image_lib->initialize($config);
                $this->image_lib->crop();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to resize any image uploaded to 200*200 pixels.I have been looking over
We need the ability to gracefully resize any photo/image to an exact width/height without
I want to resize an image so that it takes up 100% width of
I have an image that I want to resize on my websites rendering using
I have an image . I want to resize it using PIL, but it
I want to resize an image without UIScrollView in iPhone application. I want to
So, I want to resize images to a FIXED width, but proportional height. I
I want to resize the new images in a height and width of 800px
I need to resize an 200*200 image to 60*60 in rmagick without losing image
For example, I have an 1024*768 JPEG image. I want to estimate the size

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.