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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:43:04+00:00 2026-06-08T02:43:04+00:00

At the moment at once I’m learning and trying, to what CodeIgniter is able

  • 0

At the moment at once I’m learning and trying, to what CodeIgniter is able to. But I stuck at multiple thumbnails making at once. Probably, I messed up my head too much using WordPress, and trying to do something like this in Codeigniter, but anyways, here is my code

<?php

class Gallery_model extends CI_Model {

var $gallery_path;

function __construct() {
    parent::__construct();
    $this->load->helper('functions');
    $this->gallery_path = realpath(APPPATH . '../uploads');
}

function do_upload() {

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

    $this->load->library('upload', $config);
    $this->upload->do_upload();
    $image_data = $this->upload->data();


    $image_sizes = array(
        'thumb' => array(150, 100),
        'medium' => array(300, 300),
        'large' => array(800, 600)
    );

    foreach ($image_sizes as $resize) {

        $config = array(
            'source_image' => $image_data['full_path'],
            'new_image' => $this->gallery_path . '-' . $resize[0] . 'x' . $resize[1],
            'maintain_ration' => true,
            'width' => $resize[0],
            'height' => $resize[1]
        );

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

At the moment, I’m able to create just an image it self, but I cant make thumbnails with this. Maybe someone could enhance the code, and get it work 🙂

PS – I tried just take everything after $image_sizes, put it in other independent php file, run it, and var dump the $config inside of foreach, and it seemed like working.

  • 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-08T02:43:06+00:00Added an answer on June 8, 2026 at 2:43 am

    Use it like this:

    $this->load->library('image_lib');
    foreach ($image_sizes as $resize) {
    
        $config = array(
            'source_image' => $image_data['full_path'],
            'new_image' => $this->gallery_path . '-' . $resize[0] . 'x' . $resize[1],
            'maintain_ration' => true,
            'width' => $resize[0],
            'height' => $resize[1]
        );
    
        $this->image_lib->initialize($config);
        $this->image_lib->resize();
        $this->image_lib->clear();
    }
    

    initialize works better than loading the library with the $config.

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

Sidebar

Related Questions

I am just learning JavaScript at the moment and I have been able to
Okay at the moment I my self am new to programming and learning it
At the moment I am trying to HTTP response request in my Sharepoint WarmUp
At the moment I'm trying to figure out how use default and custom settings
So at the moment I'm trying to delete files listed in the directory that
At the moment we are deploying our whole application chain together and at once
At the moment I'm trying to use Python to detect when the left mouse
At the moment i'm overriding drawRect in a view in order to be able
I am trying to execute a simple bit of jQuery or JavaScript once logged
I am at the moment trying to develop a web app with Dojo (

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.