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 6190273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:33:28+00:00 2026-05-24T02:33:28+00:00

So I’m cropping an image I’m uploading with the following code (successfully): $file_name =

  • 0

So I’m cropping an image I’m uploading with the following code (successfully):

    $file_name = $this->input->post('file_name');
    $x1 = $this->input->post('x1');
    $y1 = $this->input->post('y1');
    $x2 = $this->input->post('x2');
    $y2 = $this->input->post('y2');

    //die('width: '.$width.' height: '.$height.' id: '.$id.' file_name: '.$file_name.' x1: '.$x1.' x2: '.$x2.' y1: '.$y1.' y2: '.$y2.' w: '.$w.' h: '.$h);

    $config['image_library'] = 'gd2';
    $config['source_image']    = './images/uploads/temp/'.$file_name;
    $config['maintain_ratio'] = FALSE;
    $config['width'] = $y2;
    $config['height'] = $y2;
    $config['x_axis'] = $x1;
    $config['y_axis'] = $y1;
    $this->image_lib->initialize($config); 

And at this point I want to resize the image as I have just gotten the selection and ratio I want and am not sure how to do this. Here’s what I assumed would work immediately afterward in the same method:

    $config['width'] = 180;
    $config['height'] = 180;
    $this->load->library('image_lib', $config); 
    $this->image_lib->resize();

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

It doesn’t give any errors or anything, it just doesn’t resize the image. Can you please help me figure out what’s going on?

  • 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-05-24T02:33:29+00:00Added an answer on May 24, 2026 at 2:33 am

    It’s as if the second time you load the library (thus initializing it again) it doesn’t receive all the params it needs. Are you using the code in the same method, or in another?
    Anyway, if inside the same method, as a test try doubling some configs after clearing them:

    //
    //CROPPING HERE....Then:
    //
    
    $this->image_lib->clear();
    
    $config['image_library'] = 'gd2';
    $config['source_image']    = './images/uploads/temp/'.$file_name;
    $config['maintain_ratio'] = TRUE;
    $config['width'] = 180;
    $config['height'] = 180;
    
    $this->image_lib->initialize($config);
    
    if ( ! $this->image_lib->resize())
    {
        echo $this->image_lib->display_errors();
    }
    

    And be sure to have the folder and files with correct permissions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My ASP.NET application has an image cropping and resizing features. This requires that the
I'm currently trying to code a custom image cropping system similar to other ones
I am cropping an image, and wish to return it using a ashx handler.
is there any lightweight command line batch image cropping tool(Linux or Windows) which can
I am trying to understand why after cropping an image in .NET i end
Anyone know of a good method of cropping whitespace from an image? I have
Is there an Image cropping Activity in Android? I know that when you save
I am using the following code in my website, for thumbnail creation: string furl
I have written a code that I use for cropping purpose. The scenario is
I'm trying to remove all white or transparent pixels from an image, leaving the

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.