Import CSV file into database using CodeIgniter
CSVReader is a library for CodeIgniter that can help you importing CSV files into database using CodeIgniter framework. The library uses fgetcsv function from PHP to get the content from CSV file and then iterates over the records returning an array as result.
Then, you can iterate the parsed results from the CSV file to insert them into the database easily using a foreach statement. For example, you can refer to Clooner’s proposal here.
This CSVReader library can be really helpful in case you need to import large CSV files into the database using a CodeIgniter application, but also can be useful to import Excel files into the database or any other database file that can be exported to CSV. For Excel, you can export the results using comma separated values and then use this approach.
Using MD Image to resize and crop an Image
MD_Image is a CodeIgniter Library that allows you to resize and crop images in CodeIgniter keeping a desired ratio. You can see the original thread here.
Gravatars using CodeIgniter
If you want to display avatar images in your CodeIgniter application, you can use this Gravatar helper that contains a simple function to retrieve the Gravatar image source for a given email.
The Gravatar helper was created by Dave_C as mentioned in Codeigniter Forums.
By using this helper you can easily integrate your application with Gravatars like this:
![]()
How to use the helper?
Follow the installation steps described here, and then just load the helper as usual and put this code in your view page passing the desired email as first parameter.
<?php echo gravatar( "you@domain.com" ); ?>
Encrypt and decrypt with CodeIgniter
Encryption and decryption functions are available in CodeIgniter by using the Encryption class. Of course you can always use PHP functions, but what I say is that CodeIgniter has a specific class for handling some encryption functions.
Everything is explained in the Encryption class, but the first thing you should do is configure your encryption key in config.php.
Then, you can start using for example $this->encrypt->encode() and $this->encrypt->decode().
If you need to handle passwords instead, I’d recommend to visit Handling Passwords in CodeIgniter, by Elliot.
How do I deploy my CodeIgniter applications using Subversion
This little guide is intended to explain how do I update some of my applications running on development environment or production using Subversion and a simple hook.
This idea was based on the great article published time ago by Imran Nazar about automating deployment with Subversion.
Basically it updates a SVN repository in your development environment each time you commit a message with a signal string like *DEPLOY*. This assumes that you have a copy of your repository in your development environment.




