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

  • SEARCH
  • Home
  • 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 7767705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:44:33+00:00 2026-06-01T15:44:33+00:00

I am trying to create two thumbnails of an image uploaded by user. I

  • 0

I am trying to create two thumbnails of an image uploaded by user. I repeated the code twice with a little change in configuration for second thumbnail but I get only the first thumbnail created and the second one does is not created. Here is the code:

//First Thumbnail
$conf['image_library'] = 'gd2';
$conf['source_image']   = "images/photos/123.jpg";
$conf['create_thumb'] = TRUE;
$conf['thumb_marker'] = "_1";
$conf['maintain_ratio'] = true;
$conf['width']   = 150;
$conf['height']  = 150;
$this->load->library('image_lib', $conf); 
$this->image_lib->resize();

//Second smaller Thumbnail
$conf2['image_library'] = 'gd2';
$conf2['source_image']  = "images/photos/123.jpg";
$conf2['create_thumb'] = TRUE;
$conf2['thumb_marker'] = "_2";
$conf2['maintain_ratio'] = true;
$conf2['width']  = 50;
$conf2['height']     = 50;
$this->load->library('image_lib', $conf2); 
$this->image_lib->resize();

For some reason the second part never works at all and the first part works well alone as well as with the second part. I think I should not load the library twice in same place. What can I do to fix this issue?

  • 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-01T15:44:34+00:00Added an answer on June 1, 2026 at 3:44 pm

    you need to clear the library in between, use this:

    $this->image_lib->clear();
    

    and if clearing and reloading doesn’t work, you can try just replacing the second library load with the initialize function which for some reason isn’t referred to in the ci_documentation:

    $this->image_lib->clear();
    $this->image_lib->initialize($conf2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create two form elements when the user clicks a button,
Why is the following code resulting in Segmentation fault? (I'm trying to create two
I am trying to create two little buttons with an up and down arrow,
I am trying to create two user types in django 1.3. I am subclassing
I am trying to create a high quality thumbnail of this image, with Java
I'm using Entity Framework Code First. The class i'm trying to create contains two
I'm trying to create two ASP.NET Membership login pages for an ASP.NET website I'm
I am trying to create two different sets of settings for datepicker( http://keith-wood.name/datepick.html )
I am trying to create two select lists both filled with the same times.
I'm trying to create two functions: get & set, that both accept an arbitrary

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.