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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:46:33+00:00 2026-06-04T13:46:33+00:00

I am pretty new to codeigniter and just building my first application with it,

  • 0

I am pretty new to codeigniter and just building my first application with it, but I am abit stumped when it comes to generating a thumbnail from an image.

The image uploads correctly but the thumb isnt generating and I am getting no errors 🙁

I hope someone can give me a helping hand, chances are I am just being a tit and its something really simple like mis spelling var.

Heres the code for my image model:

<?php

class Image_model extends CI_Model {

        var $image_path;

        function Image_model(){

            parent::__construct();

            $this->image_path = realpath(APPPATH.'../'.$this->config->item('dir_dynamic_images'));

        }

        function do_upload(){

            $config = array(
                    'allowed_types' => "jpeg|gif|jpg|png",
                    'upload_path' => $this->image_path,
                    'max_size' => 2000
            );

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

            $this->upload->do_upload();
            $image_data = $this->upload->data();



            $config = array(
                'source_image' => $image_data['full_path'],
                'new_image' => $this->image_path . '/thumbs',
                'maintain_ratio' => true,
                'width' => 200,
                'height' => 200
            );

            echo $config['new_image'];

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

        }               

    }
?>
  • 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-04T13:46:34+00:00Added an answer on June 4, 2026 at 1:46 pm

    I think you need to set the create_thumb parameter to true and specify the image library-

     $config = array(
                    'image_library' => 'gd2',
                    'source_image' => $image_data['full_path'],
                    'create_thumb' => true,
                    'new_image' => $this->image_path . '/thumbs',
                    'maintain_ratio' => true,
                    'width' => 200,
                    'height' => 200
                );
    

    try finding the error with –

    if(!$this->image_lib->resize()) 
    { 
       echo $this->image_lib->display_errors(); 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to iPhone development but I'm close to releasing my first app
Im pretty new to Java Web Services, but I cant find a good explanation
I am pretty new to database design. I am building a small asp.net mvc
i am pretty new to the iOS world and since I'm coming from the
I'm a pretty new with the Code Igniter (as its my first framework I'm
I'm pretty new to codeigniter and I am trying to get to know databases
Pretty new to jquery but i was hoping to be able to target a
Pretty new here. But before I ask my question, I'm not looking for teh
still pretty new to android I have to clone an iphone application. Im having
Pretty new to C# but not new in programming in generally. I'm still trying

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.