How to fix width and height of image when upload multiple images using codeigniter?



public function products()
$dataInfo = array();
$files = $_FILES;
$cpt = count($_FILES['product_image']['name']);
for($i=0; $i<$cpt; $i++)
    $_FILES['product_image']['name']= $files['product_image']['name'][$i];
    $_FILES['product_image']['type']= $files['product_image']['type'][$i];
    $_FILES['product_image']['tmp_name']= $files['product_image']['tmp_name'][$i];
    $_FILES['product_image']['error']= $files['product_image']['error'][$i];
    $_FILES['product_image']['size']= $files['product_image']['size'][$i];
            $upload_data = $this->upload->data();
            $name_array[] = $upload_data['file_name'];
            $fileName = $upload_data['file_name'];
            $images[] = $fileName;

$fileName = $images;
$data = array(
        'product_image' => implode(",",$fileName)
$sql = $this->db->insert('add_product',$data);
if($sql == true)
    echo '<p style="color:green;">New Product Added</p>';
    echo '<p style="color:red;">Unable to Proceed!</p>';


private function set_upload_options()
$config = array();
$config['upload_path'] = FCPATH.'resource/product/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '1024';
$config['overwrite'] = FALSE;
return $config;

In this code I am upload multiple images via jquery ajax which work perfectly. Now, I want that when I upload multiple images then I also fix its widht and height of all images. So, How can I do this? Please help me.

Know CodeIgniter and Reasons that attract developers towards it

Know CodeIgniter and Reasons that attract developers towards it

PHP is a most versatile general-purpose scripting language Since 1994 developers are leveraging its benefits in the development process. It offers extensive features and frameworks to develop websites easier and faster. There are several PHP...

PHP is a most versatile general-purpose scripting language Since 1994 developers are leveraging its benefits in the development process. It offers extensive features and frameworks to develop websites easier and faster. There are several PHP frameworks and among them, CodeIgniter is the most popular.

This framework offers extensive benefits to web developers such as easy debugging, built-in libraries, and easy access to modular applications. CodeIgniter development services help web developers to build dynamic customized, and fully-featured websites.

Let us know the Codeigniter powerful features that attract web developers to it.

Must-Know: Powerful CodeIgniter Features

MVC Architecture

CodeIgniter framework is based on the Model-View-Controller architecture. It helps web developers to separate the platform into three main logical parts such as data, business logic, and presentation. MVC Architecture works as the "Controller -Model - View" approach.

In-built Components

This framework is integrated with several inbuilt libraries and tools. It helps CodeIgniter web developers to build websites which are based on high functionalities and additional features. Several inbuilt tools help to maintain many other aspects such as directories, strings, file handling, and cookies. Besides this, CodeIgniter has a testing tool where developers can test their website. However, they don’t have to rely on third-party tools.

Easy to Customize

There is a high demand for customized websites with Codeigniter framework. Developers can easily develop the websites with edit or remove the existing files. The customized feature helps web developers to build websites as per the client’s desire and to configure customized files are easy with this framework.

Easy to learn

CodeIgniter framework is easy to learn as it is similar to PHP. For PHP developers, it is easy to use as it is a PHP framework. Developers have to understand the concept and they can be master in this framework.

User-Friendly Interface

Error handling function turns this platform more advanced and modern. CodeIgniter PHP framework offers a user-friendly interface, which helps to identify minor to major errors in the initial stage of the development process. It helps to turn the development into a faster process as well as avoid future failures.

Active Community

More than 57,000 registered users on the framework’s forum. However, this framework has the support of a huge and active community. Even they have created the best documentations including books, tutorials, and PDF’s. On the internet, there are many tutorials and videos for the CodeIgniter developers which turns the process of learning easy and faster. Along with this, developers’ expertise in CodeIgniter is always there to help each other.

CodeIgniter is a popular and most trending PHP platform. This framework helps to boost the functionality of the websites. It offers world-class quality better performance, data management. With the CodeIgniter framework, developers can build websites with any hassle. Now, many PHP developers are switching to this framework. Before you hire a PHP developer make sure that he is expertise in Codeigniter framework.

jQuery Full Course - jQuery Tutorial From Beginner to Advanced - Learn jQuery 2019

jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. In this video, you'll learn jQuery from Beginner to Advanced

jQuery is open-source software using the permissive MIT License. Web analysis indicates that it is the most widely deployed JavaScript library by a large margin.

Mastering jQuery will boost up your career specially in web development. This course is designed you to master yourself in jQuery through step by step process.

Course Contents

  • jQuery Intro
  • What is jQuery and what you will learn?
  • Downloading jQuery
  • jQuery Basics
  • A first look at jQuery code
  • Selectors and Filters
  • Replacing contents
  • Handling events
  • Hide/Show events
  • Fading
  • Slide
  • Toggle
  • Animate
  • Selectors
  • Filters
  • jQuery Advanced
  • Advanced Selectors
  • Creating Content
  • Creating Content: Part 2
  • Inserting content
  • Modifying content
  • Modifying CSS
  • Final thoughts

What you’ll learn

  • Will become Master in client side web development
  • Will become expert in jQuery
  • Will earn working experience on jQuery
  • Are there any course requirements or prerequisites?
  • Prior experience on HTML and CSS required.
  • Who this course is for:
  • Who wanna expert in client side web development
  • Who wanna expert in jQuery

Thanks for watching

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Top Benefits Of CodeIgniter

Top Benefits Of CodeIgniter

Free personal journal and online diary.

CodeIgniter is one of the best PHP frameworks for rapid application development. It provides you out of the box libraries for connecting to the database & performing various operations such as managing sessions, sending emails, uploading files, and so on.