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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:03:21+00:00 2026-05-24T16:03:21+00:00

I am using the following code but don’t know why thumbnails are not created.

  • 0

I am using the following code but don’t know why thumbnails are not created.

//UPLOAD IMAGE
    //some $config vars for image
    $config['upload_path'] = './images/models';
    $config['allowed_types'] = 'gif|jpg|jpeg|png|tif';
    $config['max_size'] = '0';
    $config['remove_spaces'] = true;
    $config['overwrite'] = false;
    $config['max_width'] = '0';
    $config['max_height'] = '0';

    $this->load->library('upload', $config);

    //upload main image
    if(!$this->upload->do_upload('photo')){
        $e = $this->upload->display_errors();
        print_r($e);
    }

    $image = $this->upload->data();

    //print '<pre>';
    //print_r($image); exit;

    if($image['file_name']){
        $data['photo']  = "images/models/". $image['file_name'];
        $data['raw' ]   = $image['raw_name'];
        $data['ext']    = $image['file_ext'];
    }


    //create new image
    $config0['image_library'] = 'gd2';
    $config0['source_image'] = $image['full_path'];
    $config0['new_image'] = "images/models/"."front". $image['file_name']; // you can assign your image name and location
    $config0['maintain_ratio'] = FALSE;
    $config0['width'] = 320;
    $config0['height'] = 270;

    $this->load->library('image_lib', $config0);
    if ( ! $this->image_lib->resize())
    {
    echo $this->image_lib->display_errors();
    }

    //end of new image



    $config3['image_library'] = 'gd2';
    $config3['source_image'] = $image['full_path'];
    $config3['new_image'] = "images/models/"."main". $image['file_name'];
    $config3['maintain_ratio'] = FALSE;
    $config3['width'] = 800;
    $config3['height'] = 600;

    $this->load->library('image_lib', $config3);
    $this->image_lib->initialize($config3);
    $this->image_lib->resize();



    $config4['image_library'] = 'gd2';
    $config4['source_image'] = $image['full_path'];
    $config4['new_image'] = "images/models/"."third". $image['file_name'];
    $config4['maintain_ratio'] = FALSE;
    $config4['width'] = 185;
    $config4['height'] = 125;

    $this->load->library('image_lib', $config4);
    $this->image_lib->initialize($config4);
    $this->image_lib->resize();


    //thumbnail creation start
    $config1['image_library'] = 'gd2';
    $config1['source_image'] = $image['full_path'];
    $config1['create_thumb'] = TRUE;
    $config1['maintain_ratio'] = FALSE;
    $config1['width'] = 185;
    $config1['height'] = 125;

    $this->load->library('image_lib', $config1);
    $this->image_lib->initialize($config1);
    if ( ! $this->image_lib->resize())
    {
    echo $this->image_lib->display_errors();
    }

    //THUMBNAIL ENDS
  • 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-24T16:03:23+00:00Added an answer on May 24, 2026 at 4:03 pm

    Try this. It is almost like yours. Write errors in the comments.

    //UPLOAD IMAGE
    //some $config vars for image
    $config['upload_path'] = './images/models';
    $config['allowed_types'] = 'gif|jpg|jpeg|png|tif';
    $config['max_size'] = '0';
    $config['remove_spaces'] = true;
    $config['overwrite'] = false;
    $config['max_width'] = '0';
    $config['max_height'] = '0';
    
    $this->load->library('upload', $config);
    
    //upload main image
    if(!$this->upload->do_upload('photo')){
        $e = $this->upload->display_errors();
        print_r($e);
    }else{
        $image = $this->upload->data();
    
        //print '<pre>';
        //print_r($image); exit;
    
        if($image['file_name']){
            $data['photo']  = "images/models/". $image['file_name'];
            $data['raw' ]   = $image['raw_name'];
            $data['ext']    = $image['file_ext'];
        }
    
        $config1['source_image'] = $image['full_path'];
        $config1['new_image'] = "images/models/"."front". $image['file_name']; // you can assign your image name and location
        $config1['maintain_ratio'] = FALSE;
        $config1['width'] = 320;
        $config1['height'] = 270;
    
        $this->load->library('image_lib', $config1);
        if ( ! $this->image_lib->resize())
        {
            echo $this->image_lib->display_errors();
            return;
        }
    
        $config1['new_image'] = "images/models/"."main". $image['file_name'];
        $config1['width'] = 800;
        $config1['height'] = 600;
    
        $this->image_lib->clear();
        $this->image_lib->initialize($config1);
        if ( ! $this->image_lib->resize())
        {
            echo $this->image_lib->display_errors();
            return;
        }
    
    
    
        $config1['new_image'] = "images/models/"."third". $image['file_name'];
        $config1['width'] = 185;
        $config1['height'] = 125;
    
        $this->image_lib->clear();
        $this->image_lib->initialize($config1);
        if ( ! $this->image_lib->resize())
        {
            echo $this->image_lib->display_errors();
            return;
        }
    
    
        //thumbnail creation start
        unset($config1['new_image']);
        $config1['create_thumb'] = TRUE;
    
        $this->image_lib->clear();
        $this->image_lib->initialize($config1);
        if ( ! $this->image_lib->resize())
        {
            echo $this->image_lib->display_errors();
            return;
        }
        echo "Ok";
    }
    
    //THUMBNAIL ENDS
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'using the following code to create thumbnails using ffmpeg but it was working fine
I'm attempting to translate the following C# code into IronPython but I don't know
I'm using following code but cannot return data from MySQL. This is the output:
I can drop a table if it exists using the following code but do
I am using following PHP code for trigger creation but always get error, please
I'm using the following code to query a database from my jsp, but I'd
Hi there im using the following code for insert text and images, but I
I've been using the following code to create various struct, but only give people
I'm trying to load my .mo translations using the following code, but it doesn't
I am using PageIndexChanging event for handling GridView paging in C#. But don't know

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.