<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Learning jQuery &#187; CodeIgniter</title>
	<atom:link href="http://www.learningjquery.org/index.php/tag/codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.org</link>
	<description>Learning jQuery: Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Tue, 24 Aug 2010 10:10:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easy Development With CodeIgniter</title>
		<link>http://www.learningjquery.org/index.php/easy-development-with-codeigniter/</link>
		<comments>http://www.learningjquery.org/index.php/easy-development-with-codeigniter/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 03:01:48 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CodeIgniter]]></category>

		<guid isPermaLink="false">http://www.learningjquery.org/?p=28</guid>
		<description><![CDATA[作者：Jeffrey Way
In this week’s 30 minute screencast, I’m going to show you how easy it is to work with the MVC pattern and CodeIgniter. This video is aimed at beginners who have no experience with a PHP framework.
For demonstration purposes, we’ll be building a simple image upload utility. We’ll then perform some validation, save the [...]]]></description>
			<content:encoded><![CDATA[<p>作者：<span class="entry-author-name">Jeffrey Way</span></p>
<p>In this week’s <strong>30 minute screencast</strong>, I’m going to show you how easy it is to work with the MVC pattern and CodeIgniter. This video is aimed at beginners who have no experience with a PHP framework.</p>
<p>For demonstration purposes, we’ll be building a simple image upload utility. We’ll then perform some validation, save the file to our uploads folder, and automatically create a respective thumbnail. With raw PHP, this can be somewhat time-consuming. However, with <a href="http://codeigniter.com/" target="_blank">CodeIgniter</a>, it’s simply a matter of referencing the correct library, and passing in some configuration options! Let’s dive in.</p>
<div><a href="http://nettuts.s3.amazonaws.com/363_ci_image_upload/imageUpload.zip" target="_blank"><img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg" alt="" /></a></div>
<h3>The Tutorial</h3>
<div><embed type="application/x-shockwave-flash" width="590" height="443" src="http://blip.tv/play/gcMVgYyhCAA" allowscriptaccess="never" allowfullscreen="true" wmode="transparent"></embed><span class="link popout" title="点击打开新窗口">弹出</span></div>
<h3>Final Controller</h3>
<pre>&lt;?php

class Upload extends Controller {

	function Upload() {
		parent::Controller();
		// $this-&gt;load-&gt;helper('form');
	}

	function index() {
		$this-&gt;load-&gt;view('upload_form');
	}

	function doUpload() {
		$config['upload_path'] = 'uploads/';
		$config['allowed_types'] = 'gif|jpg|jpeg|png';
		$config['max_size'] = '1000';
		$config['max_width'] = '1920';
		$config['max_height'] = '1280';						

		$this-&gt;load-&gt;library('upload', $config);

		if(!$this-&gt;upload-&gt;do_upload()) echo $this-&gt;upload-&gt;display_errors();
		else {
			$fInfo = $this-&gt;upload-&gt;data();
			$this-&gt;_createThumbnail($fInfo['file_name']);

			$data['uploadInfo'] = $fInfo;
			$data['thumbnail_name'] = $fInfo['raw_name'] . '_thumb' . $fInfo['file_ext'];
			$this-&gt;load-&gt;view('upload_success', $data);
		}
	}

	function _createThumbnail($fileName) {
		$config['image_library'] = 'gd2';
		$config['source_image'] = 'uploads/' . $fileName;
		$config['create_thumb'] = TRUE;
		$config['maintain_ratio'] = TRUE;
		$config['width'] = 75;
		$config['height'] = 75;

		$this-&gt;load-&gt;library('image_lib', $config);
		if(!$this-&gt;image_lib-&gt;resize()) echo $this-&gt;image_lib-&gt;display_errors();
	}
}</pre>
<h3>Final View</h3>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Upload an Image &lt;/title&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;/head&gt;

  &lt;body&gt;
    &lt;div id="container"&gt;
    	&lt;h2&gt;Upload an Image &lt;/h2&gt;

		&lt;?php echo form_open_multipart('upload/doUpload'); ?&gt;
		&lt;input type="file" name="userfile" /&gt;
		&lt;p&gt;&lt;input type="submit" value="Submit" name="submit" /&gt;&lt;/p&gt;
		&lt;?php echo form_close(); ?&gt;
    &lt;/div&gt;

  &lt;/body&gt;
&lt;/html&gt;</pre>
<p>I hope you guys enjoyed this video tutorial. If you’d like to see more CodeIgniter tutorials and videos on Nettuts+, please be loud in the comments. I know I’d like to see more! I’m in the process of learning this framework myself, so links to resources, tips, etc. will be much appreciated!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.learningjquery.org/index.php/easy-development-with-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
