Phil on the Net

CodeIgniters Image Library

by Phil Hawthorne on Jul.01, 2010, under Development, PHP

Frameworks can make a developers life and job a lot simpler, but that doesn’t mean they don’t come with their own headaches and hours of frustration.

Tonight I’ve been coding an image uploading script using the CodeIgniter PHP Framework. This was the first time I’ve used the built-in image library to help me cut down my coding time.

Following the user guide at http://codeigniter.com/user_guide I was attempting to load an image that had been saved to the server, from the file uploading class. The example on the website uses the following example code:

$config['image_library'] = 'gd2';
$config['source_image'] = '/path/to/image/mypic.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;

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

$this->image_lib->resize();

This code actually doesn’t work, and will result in an error “Your server does not support the GD function required to process this type of image”.

Why doesn’t it work?

As posted on the CodeIgniter Forums by user ‘gunter’, you shouldn’t loop through

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

Instead what you should do is:

$this->load->library('image_lib');
// Set your config up
$this->image_lib->initialize($config);
// Do your manipulation
$this->image_lib->clear();

(courtesy of a.somervell)

A lesson to show you that not even the documentation can always be correct. Hopefully this saves some people hours of pulling their hair out.

Leave a Comment :, , more...

Tools of the Trade

by Phil Hawthorne on May.12, 2010, under CSS, Development, HTML, JavaScript

The other day, a friend of mine asked me for some help in trying to find out the host of a client he had just picked up. Which got me thinking,  although I would still consider myself new to the trade, I could at least post up some tools that I have used in the past, and still use today for various tasks.

Whois

When you register a domain on the internet, no matter what the extension, you need to give your contact details to your domain registrar. These details can be publicly viewed by doing a whois search on your domain. Doing a whois will allow people to know who owns the domain, and how to get in contact with them.

(continue reading…)

Leave a Comment :, , , , , more...

First Post

by Phil Hawthorne on Apr.25, 2010, under Announcments, PhilHawthorne.com

Hi there,

This website has been my personal homepage for several years now. After hosting my own projects on here, and keeping a basic personal website, I think it’s time Phil on the Net took it’s next stage in life, by becoming the home of my new personal and development blog.

I have recently completed my Diploma in Information Technology, specializing in Web Development. I am a PHP Web Application Developer, based in Melbourne Australia.

I’ll be soon launching my portfolio site, which this blog will compliment by allowing me to post codes, and discuss general developments in the web application development areas that interest me, and of course allow me to blog on my own boring personal issues if I so desire.

In the mean time, if you would like to get in touch, you can do so via my Facebook page at http://facebook.com/philhawthorne

Cheers,

Phil Hawthorne

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

Other sites/pages you might be interested in...

Archives

All entries, chronologically...