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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:22:14+00:00 2026-05-28T05:22:14+00:00

I’m building an image gallery with Codeigniter everything is going good so far, but

  • 0

I’m building an image gallery with Codeigniter everything is going good so far, but I had a quick question about image resizing.

Basically I upload the source image, and make create an id then store it in that path /uploads/$id/source.jpg. Then I try to create two new images of the source image, a thumbnail and a medium image with a watermark.

When using Codeigniter’s Image Manipulation Class can you set a file name and a upload path? And when you give it the source image does it modify the source image or does it make a copy?

public function generateThumnail($source, $screenid) {
        $config['image_library'] = 'gd2';
        $config['source_image'] = "$source";
        $config['maintain_ratio'] = TRUE;
        $config['width'] = 75;
        $config['height'] = 50;

        //Not sure how I set the upload path and file name.
        $this->load->library('image_lib', $config); 
        $this->image_lib->resize();

        //TODO: Code to be added later
        $this->image_lib->clear();
}

The upload path and the file name aren’t include because I’m not sure how to add them. Is there any way to add them?

  • 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-28T05:22:15+00:00Added an answer on May 28, 2026 at 5:22 am

    Yes, you can specify an upload path but by using the File Uploading Class, not the Image Manipulation Class.

    $config['upload_path'] = './uploads/';
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size'] = '100';
    $config['max_width'] = '1024';
    $config['max_height'] = '768';
    
    $this->load->library('upload', $config);
    

    http://codeigniter.com/user_guide/libraries/file_uploading.html

    CodeIgniter will create a copy of the image if you tell it to.

    Creating a Copy

    The resizing function will create a copy of the image file (and
    preserve the original) if you set a path and/or a new filename using
    this preference:

    $config['new_image'] = '/path/to/new_image.jpg';
    

    Notes regarding this preference:

    • If only the new image name is specified it will be placed in the same folder as the original
    • If only the path is specified, the new image will be placed in the destination with the same name as the original.
    • If both the path and image name are specified it will placed in its own destination and given the new name.

    http://codeigniter.com/user_guide/libraries/image_lib.html

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I want to construct a data frame in an Rcpp function, but when I

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.