<?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>Php Flow</title>
	<atom:link href="http://phpflow.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpflow.com</link>
	<description>Php,Mysql,Jquery Tutorial And Interview  Question</description>
	<lastBuildDate>Wed, 22 May 2013 05:34:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Chatwing: The Effective Tool for Global Connectivity</title>
		<link>http://phpflow.com/misc/chatwing-the-effective-tool-for-global-connectivity/</link>
		<comments>http://phpflow.com/misc/chatwing-the-effective-tool-for-global-connectivity/#comments</comments>
		<pubDate>Wed, 22 May 2013 05:25:12 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Chatwing]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2322</guid>
		<description><![CDATA[Due to technological innovations available now, information relay has become easier than before. Connecting to people at the other end of the world is just a few clicks away. Information travels fast and questions are easily answered. Communication is one of the key factors in the society’s development. Business relies on communication. Transactions and marketing efforts are all about communicating &#8230; <a href="http://phpflow.com/misc/chatwing-the-effective-tool-for-global-connectivity/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Due to technological innovations available now, information relay has become easier than before. Connecting to people at the other end of the world is just a few clicks away. Information travels fast and questions are easily answered. Communication is one of the key factors in the society’s development. Business relies on communication. Transactions and marketing efforts are all about communicating the right message to the right target market with the use of effective medium. Online, installing a reliable communication tool will provide your website an edge over the competition.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/05/chatwing.jpg" alt="" title="chatwing" width="1366" height="768" class="aligncenter size-full wp-image-2323" /><br />
<span id="more-2322"></span><br />
Fully engaging your website visitors and promptly attending to their needs is already a good marketing step. Embed Chatwing chat app in your site to be able to accomplish this goal. Why Chatwing? Compared to other available chat widgets, Chatwing offers numerous communication and customization options. The more you are provided flexibility in using a certain chat tool, the more in control you become. </p>
<p>Chatwing provides web users communication leverage that improves online visibility and online connections. You can choose to interact to a thousand users through the regular chatbox style and pop up window or opt to communicate with a few chosen solid contacts through the vanity URL form. In terms of social network expansion, Chatwing is designed to be socially integrated online. Its multiple log in methods increases the website or blog’s accessibility to most web surfers. Chatwing chatroom can be easily accessed by just providing one’s Facebook, Twitter, Yahoo or Gmail account. You can actually limit the valid log in methods in the Chatwing dashboard. </p>
<p>If you want to start a dynamic exchange of ideas and information, connecting to other chatrooms online can be easily done as well. Go to the dashboard and provide the link of the targeted chatroom, you’re ready to party! Chatwing’s full conversation control feature lets you maintain a profanity free <a href="http://chatwing.com/" target="_blank">chat app</a> because it filters out obscene and offensive terms before it appears in the chatbox. You can also ban abusive users and set how long they will be banned from the chatroom.</p>
<p>Maximize the advantages you can get from this advanced chat software. Communication can be upgraded with just a very simple chat box that is truly dynamic and reliable.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/misc/chatwing-the-effective-tool-for-global-connectivity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Important Social Plugins of Facebook</title>
		<link>http://phpflow.com/misc/important-social-plugins-of-facebook/</link>
		<comments>http://phpflow.com/misc/important-social-plugins-of-facebook/#comments</comments>
		<pubDate>Tue, 21 May 2013 13:20:31 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Important Social Plugins of Facebook]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2317</guid>
		<description><![CDATA[Now social media is playing very important role in business, Now days company is using social media for product launching.The user can review product ans register his complain as well with help of social media. The Facebook is very important social media. Like Button: Clicking the Like button also publishes an Open Graph Like action, and displays stories on that &#8230; <a href="http://phpflow.com/misc/important-social-plugins-of-facebook/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Now social media is playing very important role in business, Now days company is using social media for product launching.The user can review product ans register his complain as well with help of<strong> social media</strong>.<br />
The <strong>Facebook </strong>is very important social media.</p>
<h4 class="label label-info">Like Button:</h4>
<p>Clicking the Like button also publishes an Open Graph Like action, and displays stories on that person&#8217;s timeline and their friends&#8217; News Feeds. This story will link back to the site and drive distribution of content.<br />
<span id="more-2317"></span></p>
<h4 class="label label-info">Send Button:</h4>
<p>The Send Button allows users to easily send content to their friends. People will have the option to send your URL in a message to their Facebook friends, to the group wall of one of their Facebook groups, and as an email to any email address. While the Like Button allows users to share content with all of their friends, the Send Button allows them to send a private message to just a few friends.</p>
<h4 class="label label-info">Follow Button:</h4>
<p>The Follow button lets a user follow your public updates on Facebook.There are two Follow button implementations:<br />
<strong>1-</strong>XFBML<br />
<strong>2-</strong>Iframe</p>
<h4 class="label label-info">Comments:</h4>
<p>Comments Box is a social plugin that enables user commenting on your site. Features include moderation tools and distribution.Friends and people who like the Page can then respond to the discussion by liking or replying to the comment directly in the News Feed on Facebook or in the Comments Box on your site.</p>
<h4 class="label label-info">Activity FeedActivity Feed:</h4>
<p>The activity feed displays stories when users interact with content on your site, such as like, watch, read, play or any custom action. </p>
<h4 class="label label-info">Recommendations Box:</h4>
<p>The Recommendations Box shows personalized recommendations to your users. Since the content is hosted by Facebook, the plugin can display personalized recommendations whether or not the user has logged into your site.</p>
<h4 class="label label-info">Recommendations Bar:</h4>
<p>The Recommendations Bar allows users to like content, get recommendations, and share what they’re reading with their friends.</p>
<h4 class="label label-info">Like Box</h4>
<p>The Like Box is a social plugin that enables Facebook Page owners to attract and gain Likes from their own website. The Like Box enables users to:</p>
<h4 class="label label-info">Login Button:</h4>
<p>The Login Button shows profile pictures of the user&#8217;s friends who have already signed up for your site in addition to a login button.</p>
<h4 class="label label-info">Registration:</h4>
<p>The Registration plugin allows users to easily sign up for your website with their Facebook account. The plugin is a simple iframe that you can drop into your page. When logged into Facebook, users see a form that is pre-filled with their Facebook information where appropriate.</p>
<h4 class="label label-info">Facepile:</h4>
<p>The Facepile plugin displays the Facebook profile pictures of users who have connected with your page via a global or custom action, or can also be configured to display users that have signed up for your site.</p>
<blockquote><p>I have taken refrence from <a href="https://developers.facebook.com/docs/plugins/" target="_blank">Here</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/misc/important-social-plugins-of-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Work with jQuery validationEngine</title>
		<link>http://phpflow.com/jquery/how-to-work-with-jquery-validationengine/</link>
		<comments>http://phpflow.com/jquery/how-to-work-with-jquery-validationengine/#comments</comments>
		<pubDate>Fri, 17 May 2013 05:25:37 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[jQuery validationEngine]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2311</guid>
		<description><![CDATA[In this tutorial I will describe how to integrate jquery validation engine in your application.jQuery provide a very awesome library to validate form. jQuery validation engine is a JavaScript plugin aimed at the validation of form fields in the browser (IE 6-8, Chrome, Firefox, Safari, Opera 10). The plugin provides visually appealing prompts that grab user attention on the subject &#8230; <a href="http://phpflow.com/jquery/how-to-work-with-jquery-validationengine/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will describe how to integrate jquery validation engine in your application.jQuery provide a very awesome library to validate form.<br />
jQuery validation engine is a JavaScript plugin aimed at the validation of form fields in the browser (IE 6-8, Chrome, Firefox, Safari, Opera 10). The plugin provides visually appealing prompts that grab user attention on the subject matter.</p>
<p>Validations range from email, phone, and URL, to more complex calls such as Ajax processing or custom JavaScript functions. Bundled with many locales, the error prompts can be translated into the language of your choice.<br />
<span id="more-2311"></span><br />
<strong>How to use:</strong><br />
<strong>Step1:</strong> Add jquery library.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
</pre>
<pre><span class="js"><span class="js-operator">&lt;</span>script src<span class="js-operator">=</span><span class="js-string">&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js&quot;</span> type<span class="js-operator">=</span><span class="js-string">&quot;text/
javascript&quot;</span><span class="js-operator">&gt;</span><span class="js-operator">&lt;</span><span class="js-operator">/</span>script<span class="js-operator">&gt;</span></span></pre>
</div>
<p><strong>Step 2:</strong> Include validationEngine JS library.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
</pre>
<pre><span class="js"><span class="js-operator">&lt;</span>script src<span class="js-operator">=</span><span class="js-string">&quot;js/jquery.validationEngine-en.js&quot;</span> type<span class="js-operator">=</span><span class="js-string">&quot;text/javascript&quot;</span> charset<span class="js-operator">=</span><span class="js-string">&quot;utf-8&quot;</span><span class="js-operator">&gt;</span><span class="js-operator">&lt;</span><span class="js-operator">/</span>script<span class="js-operator">&gt;</span>
<span class="js-operator">&lt;</span>script src<span class="js-operator">=</span><span class="js-string">&quot;js/jquery.validationEngine.js&quot;</span> type<span class="js-operator">=</span><span class="js-string">&quot;text/javascript&quot;</span> charset<span class="js-operator">=</span><span class="js-string">&quot;utf-8&quot;</span><span class="js-operator">&gt;</span><span class="js-operator">&lt;</span><span class="js-operator">/</span>script<span class="js-operator">&gt;</span></span></pre>
</div>
<p><strong>Step 3:</strong> Include validationEngine CSS library.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre><span class="js"><span class="js-operator">&lt;</span><span class="js-client-keyword">link</span> rel<span class="js-operator">=</span><span class="js-string">&quot;stylesheet&quot;</span> href<span class="js-operator">=</span><span class="js-string">&quot;css/validationEngine.jquery.css&quot;</span> type<span class="js-operator">=</span><span class="js-string">&quot;text/css&quot;</span><span class="js-operator">/</span><span class="js-operator">&gt;</span></span></pre>
</div>
<p><strong>Step 4:</strong> Add class into field.There are many predefined class attribute for different validation type.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
</pre>
<pre><span class="html"><span class="html-form-element">&lt;form id=<span class="html-attribute">&quot;formID&quot;</span> method=<span class="html-attribute">&quot;post&quot;</span> action=<span class="html-attribute">&quot;submit.action&quot;</span>&gt;</span>
    <span class="html-form-element">&lt;input value=<span class="html-attribute">&quot;2010-12-01&quot;</span> class=<span class="html-attribute">&quot;validate[required,custom[date]]&quot;</span> type=<span class="html-attribute">&quot;text&quot;</span> name=<span class="html-attribute">&quot;date&quot;</span> id=<span class="html-attribute">&quot;date&quot;</span> /&gt;</span>
<span class="html-form-element">&lt;/form&gt;</span></span></pre>
</div>
<p><strong>Step 5:</strong> Instantiate validate Engine based on form id.<br />
$(&#8220;#form.id&#8221;).validationEngine();</p>
<h4 class="label label-success">Result:</h4>
<p><img src="http://phpflow.com/wp-content/uploads/2013/05/validateengine.png" alt="validateengine" title="validateengine" width="466" height="381" class="aligncenter size-full wp-image-2312" /></p>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/jquery/how-to-work-with-jquery-validationengine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Jquery Image Crop Library</title>
		<link>http://phpflow.com/jquery/best-jquery-image-crop-library/</link>
		<comments>http://phpflow.com/jquery/best-jquery-image-crop-library/#comments</comments>
		<pubDate>Sun, 12 May 2013 05:37:11 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Best Jquery Image Crop Library]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2304</guid>
		<description><![CDATA[The cropping is used to manipulation of uploded image.Cropping is one of the most used photo manipulation techniques and in this tutorial we take a look some of the most popular JavaScripts Image Cropping scripts. 1-imageareaselect:imgAreaSelect is a jQuery plugin for selecting a rectangular area of an image. It allows web developers to easily implement image cropping functionality, as well &#8230; <a href="http://phpflow.com/jquery/best-jquery-image-crop-library/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>The cropping is used to manipulation of uploded image.Cropping is one of the most used photo manipulation techniques and in this tutorial we take a look some of the most popular JavaScripts Image Cropping scripts.</p>
<p>1-<a href="http://odyniec.net/projects/imgareaselect/" target="_blank">imageareaselect</a>:imgAreaSelect is a jQuery plugin for selecting a rectangular area of an image. It allows web developers to easily implement image cropping functionality, as well as other user interface features, such as photo notes (like those on Flickr).<br />
<span id="more-2304"></span><br />
2-<a href="http://uvumitools.com/crop.html" target="_blank">uvumitools</a>:This simplified tool gives your users the ability to create a selection area that can be used to crop an image live on your web site. This is an extremely useful too for any site that provides image hosting, for example.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/05/ummitools.bmp" alt="" title="ummitools" class="aligncenter size-full wp-image-2305" /></p>
<p>3-<a href="http://www.dhtmlgoodies.com/index.html?whichScript=image-crop" target="_blank">Javascript Image Cropper UI</a>:It has been developped by DHTMLGoodies.This script has all the basic features required for a perfect image cropping solution. It works by dragging a rectangle around the area you want to crop.</p>
<p>4-<a href="http://www.image-cropper.com/index.php" target="_blank">Kroppr</a>:Kroppr is intended to allow users to manipulate the images available on a website. There are plenty of online image cropping scripts that are used to create avatars, scale or crop images, for photo resize and photo crop &#8211; but, on top of that, Kroppr offers image rotation and some other features without any plugin required (Flash or Java).<br />
<img src="http://phpflow.com/wp-content/uploads/2013/05/kropper.bmp" alt="" title="kropper" class="aligncenter size-full wp-image-2307" /></p>
<p>5-<a href="http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/comment-page-1/" target="_blank">Javascript Image Cropper UI</a>:The JavaScript image cropper UI allows the user to crop an image using an interface with the same features and styling as found in commercial image editing software, and is is based on the Prototype JavaScript framework and script.aculo.us.</p>
<p>6-<a href="http://deepliquid.com/content/Jcrop.html" target="_blank">Jcrop</a>:Jcrop is the quick and easy way to add image cropping functionality to your web application. It combines the ease-of-use of a typical jQuery plugin with a powerful cross-platform DHTML cropping engine that is faithful to familiar desktop graphics applications.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/05/jcrop.bmp" alt="" title="jcrop" class="aligncenter size-full wp-image-2306" /></p>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/jquery/best-jquery-image-crop-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create model window</title>
		<link>http://phpflow.com/jquery/create-to-create-model-window/</link>
		<comments>http://phpflow.com/jquery/create-to-create-model-window/#comments</comments>
		<pubDate>Fri, 10 May 2013 05:43:58 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[model window]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2296</guid>
		<description><![CDATA[In this tutorial, we will learn how to create popup box based on URL.The url can be seperate file or mvc based url.We will use window manager class to create model box.The open method takes class name,window id and content url as parametrs. The source code is below: 1 2 3 4 5 6 7 8 9 10 11 12 &#8230; <a href="http://phpflow.com/jquery/create-to-create-model-window/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial, we will learn how to create popup box based on URL.The url can be seperate file or mvc based url.We will use window manager class to create model box.The open method takes class name,window id and content url as parametrs.</p>
<p><strong>The source code is below:</strong></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre>
<pre><span class="php">jQuery<span class="php-brackets">(</span><span class="php-string">'#modellink'</span><span class="php-brackets">)</span><span class="php-operator">.</span>click<span class="php-brackets">(</span><span class="php-function">function</span><span class="php-brackets">(</span>e<span class="php-brackets">)</span> <span class="php-brackets">{</span>
            WindowManager<span class="php-operator">.</span>open<span class="php-brackets">(</span><span class="php-brackets">{</span>
                <span class="php-string">'winId'</span> <span class="php-operator">:</span> <span class="php-string">'add-box'</span>,
                <span class="php-string">'addClass'</span> <span class="php-operator">:</span> <span class="php-string">'modal600'</span>,
                <span class="php-string">'title'</span> <span class="php-operator">:</span> <span class="php-string">'Add Team'</span>,
                <span class="php-string">'contentURL'</span><span class="php-operator">:</span> jQuery<span class="php-brackets">(</span>this<span class="php-brackets">)</span><span class="php-operator">.</span>attr<span class="php-brackets">(</span><span class="php-string">'data-url'</span><span class="php-brackets">)</span>,
                <span class="php-string">'data'</span> <span class="php-operator">:</span> <span class="php-brackets">{</span><span class="php-brackets">}</span>,
                <span class="php-string">'type'</span> <span class="php-operator">:</span> <span class="php-string">'POST'</span>
            <span class="php-brackets">}</span><span class="php-brackets">)</span>;
        <span class="php-brackets">}</span><span class="php-brackets">)</span>;</span></pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/jquery/create-to-create-model-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Hello Example</title>
		<link>http://phpflow.com/misc/simple-hello-example/</link>
		<comments>http://phpflow.com/misc/simple-hello-example/#comments</comments>
		<pubDate>Sun, 05 May 2013 02:31:34 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Simple Hello Example]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=1998</guid>
		<description><![CDATA[Hi friends, in this tutorial i will describe simple hello example in Perl.Perl is very simple programming language and easy to use. in the below script first line tells the script compiler and second line tells the response content of script.Third line contains the &#8216;print&#8217; constructor which is use to print variable in Perl. 1 2 3 4 5 #!C:/Perl/bin/perl.exe &#8230; <a href="http://phpflow.com/misc/simple-hello-example/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Hi friends, in this tutorial i will describe simple hello example in Perl.Perl is very simple programming language and easy to use.<br />
 in the below script first line tells the script compiler and second line tells the response content of script.Third line contains the &#8216;print&#8217; constructor which is use to print variable in Perl.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
</pre>
<pre>#!C:/Perl/bin/perl.exe
print &quot;Content-Type: text/html; charset=iso-8859-1\n\n&quot;;
print &quot;Hello World&quot;;</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/misc/simple-hello-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started with the New Facebook APIs</title>
		<link>http://phpflow.com/uncategorized/getting-started-with-the-new-facebook-apis/</link>
		<comments>http://phpflow.com/uncategorized/getting-started-with-the-new-facebook-apis/#comments</comments>
		<pubDate>Wed, 24 Apr 2013 04:24:03 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2277</guid>
		<description><![CDATA[Earlier Facebook has been launched comment replies on Facebook pages and profiles with more than 10,000 followers and now Facebook are updating the API so developers can build tools that make it easier for brands to monitor and respond to comment replies. How to get comment replies through graph api: Top Level Comments The top level view of comments corresponds &#8230; <a href="http://phpflow.com/uncategorized/getting-started-with-the-new-facebook-apis/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Earlier Facebook has been launched comment replies on Facebook pages and profiles with more than 10,000 followers and now Facebook are updating the API so developers can build tools that make it easier for brands to monitor and respond to comment replies.</p>
<p><strong>How to get comment replies through graph api:</strong></p>
<p><strong>Top Level Comments</strong><br />
The top level view of comments corresponds to what a user would see on Facebook. To get the top level view of comments in Graph API:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre><span class="php"><span class="php-brackets">{</span>object_id<span class="php-brackets">}</span><span class="php-operator">/</span>comments<span class="php-operator">?</span>filter<span class="php-operator">=</span>toplevel</span></pre>
</div>
<p><span id="more-2277"></span><br />
<strong>Replies</strong></p>
<p>Comments on comments are called &#8220;replies.&#8221; You get replies by querying for the comments on a comment id.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre><span class="php"><span class="php-brackets">{</span>comment_id<span class="php-brackets">}</span><span class="php-operator">/</span>comments</span></pre>
</div>
<p><strong>Comment Stream</strong><br />
The comments &#8220;stream&#8221; gives all comments (top level and replies to comments) together. The &#8220;stream&#8221; view provides comments in chronological order.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre><span class="php"><span class="php-brackets">{</span>object_id<span class="php-brackets">}</span><span class="php-operator">/</span>comments<span class="php-operator">?</span>filter<span class="php-operator">=</span>stream</span></pre>
</div>
<p><strong>How to enable this fucntionality in your app:</strong><br />
1- Selecte opt into the &#8220;July 2013 Breaking Changes&#8221; migration for your app by visiting the Advanced tab of your app dashboard.</p>
<p>If you&#8217;re currently using our existing comments APIs, here are a few changes to keep in mind:</p>
<p>1- &#8216;comments&#8217; field from &#8216;stream&#8217; FQL table is deprecated. Please use the&#8217;comment_info&#8217; column to fetch the &#8216;can_comment&#8217; and &#8216;comment_count&#8217; fields.</p>
<p>2- Facebook are removing the fields on the FQL &#8216;comment&#8217; table that were used exclusively for legacy Comments Plugins &#8212; &#8216;xid&#8217;, &#8216;reply_xid&#8217;, &#8216;username&#8217; and &#8216;comments&#8217;.</p>
<p>3- Facebook are removing the undocumented &#8216;count&#8217; field on the &#8216;comments&#8217; connection in the Graph API. Please request &#8216;{id}/comments?summary=true&#8217; explicitly if you would like the summary field which contains the count (now called &#8216;total_count&#8217;)</p>
<p>Please read the <a href="https://developers.facebook.com/docs/graphapi/guides/comments/#threaded" target="_blank">documentation</a> for details on how to use these new features and the Roadmap for details on the API changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/uncategorized/getting-started-with-the-new-facebook-apis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Cross Platform Mobile Tools</title>
		<link>http://phpflow.com/misc/best-cross-platform-mobile-tools/</link>
		<comments>http://phpflow.com/misc/best-cross-platform-mobile-tools/#comments</comments>
		<pubDate>Sun, 21 Apr 2013 04:53:39 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[jQTouch]]></category>
		<category><![CDATA[mobile tool]]></category>
		<category><![CDATA[Mono iOS/Android]]></category>
		<category><![CDATA[RhoMobile]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2279</guid>
		<description><![CDATA[Mobile application industires is going to rapid way,so basic need of all application must be run on desktop browser as well as mobile devices.The devices may be varry based on plateform,orientation and size of device screen. 1-jQuery Mobile: jQuery Mobile is aa HTML5-based user interface system for mobile device platforms, built on the jQuery and jQuery UI foundation. 2-Sencha Touch: &#8230; <a href="http://phpflow.com/misc/best-cross-platform-mobile-tools/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Mobile application industires  is going to rapid way,so basic need of all application must be run on desktop browser as well as mobile devices.The devices may be varry based on plateform,orientation and size of device screen.</p>
<p>1-<a href="http://jquerymobile.com/" target="_blank">jQuery Mobile</a>: jQuery Mobile is aa HTML5-based user interface system for mobile device platforms, built on the jQuery and jQuery UI foundation.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/04/jquery.png" alt="jquery" title="jquery" width="524" height="135" class="aligncenter size-full wp-image-2281" /><br />
<span id="more-2279"></span><br />
2-<a href="http://www.sencha.com/products/touch/" target="_blank">Sencha Touch</a>: Sencha Touch is a high-performance HTML5 mobile application framework for iPhone, Android, and BlackBerry.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/04/sencha.png" alt="sencha" title="sencha" width="692" height="311" class="aligncenter size-full wp-image-2282" /></p>
<p>3-<a href="http://phonegap.com" target="_blank">PhoneGap (Apache Cordova)</a>: This is an HTML5 app platform that allows you to author native applications with web technologies and get access to APIs and app stores.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/04/phonegap.jpg" alt="phonegap" title="phonegap" width="587" height="523" class="aligncenter size-full wp-image-2283" /></p>
<p>4-<a href="http://www.adobe.com/devnet/devices.html" target="_blank">Adobe AIR</a>: Adobe AIR is a framework to build applications that run on the Apple iOS, Google Android, and BlackBerry Tablet OS platforms.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/04/adobe.jpg" alt="adobe" title="adobe" width="505" height="238" class="aligncenter size-full wp-image-2284" /></p>
<p>5-<a href="http://xamarin.com" target="_blank">Mono iOS/Android</a>: This ia a framework for creating iOS and Android apps, suing C# and .NET. <a href=""http://xamarin.com/" target="_blank"></a>.</p>
<p><img src="http://phpflow.com/wp-content/uploads/2013/04/mono.png" alt="mono" title="mono" width="458" height="247" class="aligncenter size-full wp-image-2288" /></p>
<p>6-<a href="http://rhomobile.com" target="_blank">RhoMobile</a> : RhoMobile is a framework for building native apps for iPhone, Android, Windows Mobile, and Windows Phone 7.</p>
<p><img src="http://phpflow.com/wp-content/uploads/2013/04/rho.jpg" alt="rho" title="rho" width="549" height="324" class="aligncenter size-full wp-image-2285" /></p>
<p>7-<a href="http://www.jqtouch.com/" target="_blank">jQTouch</a>:jQTouchis is a Zepto/jQuery plugin for mobile web development on the iPhone, Android and other devices.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/04/jqtouch.jpg" alt="jqtouch" title="jqtouch" width="592" height="383" class="aligncenter size-full wp-image-2286" /></p>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/misc/best-cross-platform-mobile-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Releases New Dart SDK Milestone 4</title>
		<link>http://phpflow.com/php/google-releases-new-dart-sdk-milestone-4/</link>
		<comments>http://phpflow.com/php/google-releases-new-dart-sdk-milestone-4/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 06:36:20 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Dart SDK Milestone 4]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2271</guid>
		<description><![CDATA[Google on Tuesday has been released new Dart SDK Milestone 4 (v0.4.7 r21548). You can download here. This versions is the fourth milestone now from dartlang.org/tools. The Dart is Google’s open-source project for structured and scalable web programming. Dart compiles to JavaScript and runs across the open modern web.. The official changes log for Dark SDK are following: 1- Core, &#8230; <a href="http://phpflow.com/php/google-releases-new-dart-sdk-milestone-4/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Google on Tuesday has been released new Dart SDK Milestone 4 (v0.4.7 r21548). You can <a href="http://www.dartlang.org/tools/" target="_blank">download</a> here. This versions is the fourth milestone now from dartlang.org/tools.</p>
<p>The <strong>Dart is Google’s open-source </strong>project for structured and scalable web programming. Dart compiles to JavaScript and runs across the open modern web..<br />
<span id="more-2271"></span></p>
<h4 class="label label-info">The official changes log for Dark SDK are following:</h4>
<p><strong>1-</strong> Core, collection, and async libraries are now stable. There will be no more breaking changes to these libraries.<br />
<strong>2-</strong>Performance improved in both the dart2js compiler and the Dart VM.<br />
<strong>3-</strong>Dart Editor comes with an all-new analysis engine for faster real-time feedback.<br />
<strong>4-</strong>Classes can be used as mixins.</p>
<p>Google said, dart2js now generates more efficient code. Compared to the previous M3 release, DeltaBlue runs twice as fast and Richards runs 40% faster. The native Dart VM now runs Richards twice as fast as V8. On DeltaBlue, the VM improved by 22%. Details are available at dartlang.org/performance.<br />
<img src="http://phpflow.com/wp-content/uploads/2013/04/dart.png" alt="dart" title="dart" width="533" height="333" class="aligncenter size-full wp-image-2272" /></p>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/php/google-releases-new-dart-sdk-milestone-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image Crop Functionality In Model Box</title>
		<link>http://phpflow.com/php/image-crop-functionality-in-model-box/</link>
		<comments>http://phpflow.com/php/image-crop-functionality-in-model-box/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 05:56:51 +0000</pubDate>
		<dc:creator>Parvez</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Image Crop]]></category>

		<guid isPermaLink="false">http://phpflow.com/?p=2264</guid>
		<description><![CDATA[In this tutorial i will described how to create crop image functionality in model box or popup box. This is very interesting functionality. We have used following jquery library to crop image. 1- Ajax form submit library 2- Imgareaselect library Step 1:We will create HTML layout. First we will include library 1 2 3 &#60;script src=&#34;jquery.imgareaselect.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62; &#60;script src=&#34;jquery.form.js&#34;&#62;&#60;/script&#62; Creating &#8230; <a href="http://phpflow.com/php/image-crop-functionality-in-model-box/">Continue reading &#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial i will described how to create crop image functionality in model box or popup box.<br />
This is very interesting functionality. We have used following jquery library to crop image.<br />
<strong>1-</strong> Ajax form submit library<br />
<strong>2-</strong> Imgareaselect library<br />
<span id="more-2264"></span><br />
<strong>Step 1:</strong>We will create HTML layout.</p>
<p><strong>First we will include library</strong></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
</pre>
<pre><span class="html"><span class="html-script-element">&lt;script src=<span class="html-attribute">&quot;jquery.imgareaselect.js&quot;</span> type=<span class="html-attribute">&quot;text/javascript&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>
<span class="html-script-element">&lt;script src=<span class="html-attribute">&quot;jquery.form.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span></span></pre>
</div>
<p><strong>Creating div to show image after crop.</strong></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
</pre>
<pre><span class="html"><span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;control-group no-margin-bottom&quot;</span>&gt;</span>
<span class="html-other-element">&lt;label class=<span class="html-attribute">&quot;control-label width-120&quot;</span>&gt;</span>My Avatar :<span class="html-other-element">&lt;/label&gt;</span>
                  <span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;control-label tl line-height-20px&quot;</span> id=<span class="html-attribute">&quot;span-change-avatar&quot;</span>&gt;</span><span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;pickArea pull-left&quot;</span>&gt;</span>
   <span class="html-comment">&lt;!--&lt;img src=&quot; /&gt;!--&gt;</span>
      <span class="html-image-element">&lt;img width=<span class="html-attribute">&quot;128&quot;</span> id=<span class="html-attribute">&quot;avatar-edit-img&quot;</span> height=<span class="html-attribute">&quot;128&quot;</span> src=<span class="html-attribute">&quot;&lt;?php echo getCustomAvatar($userId);?</span>&gt;</span>&quot; /&gt;<span class="html-other-element">&lt;/div&gt;</span>
	  <span class="html-other-element">&lt;/span&gt;</span> <span class="html-other-element">&lt;/div&gt;</span></span></pre>
</div>
<p><strong>Now we will create model box to uplode and crop image.</strong></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre>
<pre><span class="html"><span class="html-comment">&lt;!--model box --&gt;</span>
<span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;modal&quot;</span> id=<span class="html-attribute">&quot;changePic&quot;</span> style=<span class="html-attribute">&quot;<span class="css"><span class="css"><span class="css-property">display<span class="css-selector">:</span><span class="css-value"> none</span></span>;<span class="css-property">top<span class="css-selector">:</span><span class="css-value"> 62%</span></span></span></span>&quot;</span>&gt;</span>
    <span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;modal-header&quot;</span>&gt;</span>
    <span class="html-form-element">&lt;button class=<span class="html-attribute">&quot;close closeAvatar&quot;</span> data-dismiss=<span class="html-attribute">&quot;modal&quot;</span>&gt;</span>×<span class="html-form-element">&lt;/button&gt;</span>
    <span class="html-other-element">&lt;h3&gt;</span>Change Profile Picture<span class="html-other-element">&lt;/h3&gt;</span>
    <span class="html-other-element">&lt;/div&gt;</span>
    <span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;modal-body&quot;</span>&gt;</span>
    <span class="html-form-element">&lt;form id=<span class="html-attribute">&quot;cropimage&quot;</span> method=<span class="html-attribute">&quot;post&quot;</span> enctype=<span class="html-attribute">&quot;multipart/form-data&quot;</span> action=<span class="html-attribute">&quot;&lt;?php echo home_url();?</span>&gt;</span>/profiles/changeAvatar/&quot;&gt;
	Upload your image <span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;file&quot;</span> name=<span class="html-attribute">&quot;photoimg&quot;</span> id=<span class="html-attribute">&quot;photoimg&quot;</span> /&gt;</span>
	<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;hidden&quot;</span> name=<span class="html-attribute">&quot;hdn-profile-id&quot;</span> id=<span class="html-attribute">&quot;hdn-profile-id&quot;</span> value=<span class="html-attribute">&quot;&lt;?php echo $userId; ?</span>&gt;</span>&quot; /&gt;
	<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;hidden&quot;</span> name=<span class="html-attribute">&quot;hdn-x1-axis&quot;</span> id=<span class="html-attribute">&quot;hdn-x1-axis&quot;</span> value=<span class="html-attribute">&quot;&quot;</span> /&gt;</span>
	<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;hidden&quot;</span> name=<span class="html-attribute">&quot;hdn-y1-axis&quot;</span> id=<span class="html-attribute">&quot;hdn-y1-axis&quot;</span> value=<span class="html-attribute">&quot;&quot;</span> /&gt;</span>
	<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;hidden&quot;</span> name=<span class="html-attribute">&quot;hdn-x2-axis&quot;</span> value=<span class="html-attribute">&quot;&quot;</span> id=<span class="html-attribute">&quot;hdn-x2-axis&quot;</span> /&gt;</span>
	<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;hidden&quot;</span> name=<span class="html-attribute">&quot;hdn-y2-axis&quot;</span> value=<span class="html-attribute">&quot;&quot;</span> id=<span class="html-attribute">&quot;hdn-y2-axis&quot;</span> /&gt;</span>
	<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;hidden&quot;</span> name=<span class="html-attribute">&quot;hdn-thumb-width&quot;</span> id=<span class="html-attribute">&quot;hdn-thumb-width&quot;</span> value=<span class="html-attribute">&quot;&quot;</span> /&gt;</span>
	<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;hidden&quot;</span> name=<span class="html-attribute">&quot;hdn-thumb-height&quot;</span> id=<span class="html-attribute">&quot;hdn-thumb-height&quot;</span> value=<span class="html-attribute">&quot;&quot;</span> /&gt;</span>

	<span class="html-other-element">&lt;div id=<span class="html-attribute">'preview-avatar-profile'</span>&gt;</span>
<span class="html-other-element">&lt;/div&gt;</span>
<span class="html-other-element">&lt;div id=<span class="html-attribute">&quot;thumbs&quot;</span> style=<span class="html-attribute">&quot;<span class="css"><span class="css"><span class="css-property">padding<span class="css-selector">:</span><span class="css-value">5px</span></span>; <span class="css-property">width<span class="css-selector">:</span><span class="css-value">600px</span></span></span></span>&quot;</span>&gt;</span><span class="html-other-element">&lt;/div&gt;</span>
<span class="html-form-element">&lt;/form&gt;</span>

    <span class="html-other-element">&lt;/div&gt;</span>
	<span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;modal-footer&quot;</span>&gt;</span>
                <span class="html-anchor-element">&lt;a href=<span class="html-attribute">&quot;javascript:void(0)&quot;</span> class=<span class="html-attribute">&quot;btn btn-close closeAvatar&quot;</span>  data-dismiss=<span class="html-attribute">&quot;modal&quot;</span>&gt;</span><span class="html-image-element">&lt;img height=<span class="html-attribute">&quot;18px&quot;</span> width=<span class="html-attribute">&quot;18px&quot;</span> src=<span class="html-attribute">&quot;&lt;?php echo get_stylesheet_directory_uri(); ?</span>&gt;</span>/wp_home_page/images/Cancel.png&quot;&gt;<span class="html-special-char">&amp;nbsp;</span>Close<span class="html-anchor-element">&lt;/a&gt;</span>
                <span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;button&quot;</span> id=<span class="html-attribute">&quot;btn-crop&quot;</span> name=<span class="html-attribute">&quot;submit&quot;</span> value=<span class="html-attribute">&quot;Crop &amp; Save&quot;</span> /&gt;</span>
            <span class="html-other-element">&lt;/div&gt;</span>

    <span class="html-other-element">&lt;/div&gt;</span></span></pre>
</div>
<p><strong>Step 2:</strong> Java script code:<br />
show the model box when we will click change pic button.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
</pre>
<pre><span class="js">jQuery<span class="js-bracket">(</span><span class="js-string">'#change-pic'</span><span class="js-bracket">)</span>.live<span class="js-bracket">(</span><span class="js-string">'click'</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span>e<span class="js-bracket">)</span><span class="js-bracket">{</span>
		e.preventDefault<span class="js-bracket">(</span><span class="js-bracket">)</span>;

		jQuery<span class="js-bracket">(</span><span class="js-string">'#changePic'</span><span class="js-bracket">)</span>.show<span class="js-bracket">(</span><span class="js-bracket">)</span>;

	<span class="js-bracket">}</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p><strong>Ajax form submitting and show the image for crop process.</strong></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre>
<pre><span class="js">jQuery<span class="js-bracket">(</span><span class="js-string">'#photoimg'</span><span class="js-bracket">)</span>.live<span class="js-bracket">(</span><span class="js-string">'change'</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span>
<span class="js-bracket">{</span>
jQuery<span class="js-bracket">(</span><span class="js-string">&quot;#preview-avatar-profile&quot;</span><span class="js-bracket">)</span>.html<span class="js-bracket">(</span><span class="js-string">''</span><span class="js-bracket">)</span>;
jQuery<span class="js-bracket">(</span><span class="js-string">&quot;#preview-avatar-profile&quot;</span><span class="js-bracket">)</span>.html<span class="js-bracket">(</span><span class="js-string">'Uploading....'</span><span class="js-bracket">)</span>;
jQuery<span class="js-bracket">(</span><span class="js-string">&quot;#cropimage&quot;</span><span class="js-bracket">)</span>.ajaxForm<span class="js-bracket">(</span>
<span class="js-bracket">{</span>
target<span class="js-operator">:</span> <span class="js-string">'#preview-avatar-profile'</span>,
success<span class="js-operator">:</span>    <span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
        jQuery<span class="js-bracket">(</span><span class="js-string">'img#photo'</span><span class="js-bracket">)</span>.imgAreaSelect<span class="js-bracket">(</span><span class="js-bracket">{</span>
        aspectRatio<span class="js-operator">:</span> <span class="js-string">'1:1'</span>,
        onSelectEnd<span class="js-operator">:</span> getSizes,
    <span class="js-bracket">}</span><span class="js-bracket">)</span>;
    <span class="js-bracket">}</span>
<span class="js-bracket">}</span><span class="js-bracket">)</span>.<span class="js-client-keyword">submit</span><span class="js-bracket">(</span><span class="js-bracket">)</span>;

<span class="js-bracket">}</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p><strong>crop image and call save method.</strong></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
</pre>
<pre><span class="js">jQuery<span class="js-bracket">(</span><span class="js-string">'#btn-crop'</span><span class="js-bracket">)</span>.live<span class="js-bracket">(</span><span class="js-string">'click'</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span>e<span class="js-bracket">)</span><span class="js-bracket">{</span>
	e.preventDefault<span class="js-bracket">(</span><span class="js-bracket">)</span>;
	params <span class="js-operator">=</span> <span class="js-bracket">{</span>
            targetUrl<span class="js-operator">:</span> <span class="js-string">'profiles/saveAvatarTmp/'</span>,
            action<span class="js-operator">:</span> <span class="js-string">'profiles_controller_saveAvatarTmp'</span>,
			x_axis<span class="js-operator">:</span> jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-x1-axis'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>,
			y_axis <span class="js-operator">:</span> jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-y1-axis'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>,
			x<span class="js-number">2</span>_axis<span class="js-operator">:</span> jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-x2-axis'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>,
			y<span class="js-number">2</span>_axis <span class="js-operator">:</span> jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-y2-axis'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>,
			thumb_width <span class="js-operator">:</span> jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-thumb-width'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>,
			thumb_height<span class="js-operator">:</span>jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-thumb-height'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>
        <span class="js-bracket">}</span>;
		saveCropImage<span class="js-bracket">(</span>params<span class="js-bracket">)</span>;
	<span class="js-bracket">}</span><span class="js-bracket">)</span>;

	Save image ajax request<span class="js-operator">:</span>

	<span class="js-function-keyword">function</span> getSizes<span class="js-bracket">(</span>img, obj<span class="js-bracket">)</span>
	<span class="js-bracket">{</span>
		<span class="js-reserved-keyword">var</span> x_axis <span class="js-operator">=</span> obj.x<span class="js-number">1</span>;
		<span class="js-reserved-keyword">var</span> x<span class="js-number">2</span>_axis <span class="js-operator">=</span> obj.x<span class="js-number">2</span>;
		<span class="js-reserved-keyword">var</span> y_axis <span class="js-operator">=</span> obj.y<span class="js-number">1</span>;
		<span class="js-reserved-keyword">var</span> y<span class="js-number">2</span>_axis <span class="js-operator">=</span> obj.y<span class="js-number">2</span>;
		<span class="js-reserved-keyword">var</span> thumb_width <span class="js-operator">=</span> obj.width;
		<span class="js-reserved-keyword">var</span> thumb_height <span class="js-operator">=</span> obj.height;
		<span class="js-reserved-keyword">if</span><span class="js-bracket">(</span>thumb_width <span class="js-operator">&gt;</span> <span class="js-number">0</span><span class="js-bracket">)</span>
			<span class="js-bracket">{</span>

				jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-x1-axis'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span>x_axis<span class="js-bracket">)</span>;
				jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-y1-axis'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span>y_axis<span class="js-bracket">)</span>;
				jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-x2-axis'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span>x<span class="js-number">2</span>_axis<span class="js-bracket">)</span>;
				jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-y2-axis'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span>y<span class="js-number">2</span>_axis<span class="js-bracket">)</span>;
				jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-thumb-width'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span>thumb_width<span class="js-bracket">)</span>;
				jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-thumb-height'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span>thumb_height<span class="js-bracket">)</span>;

			<span class="js-bracket">}</span>
		<span class="js-reserved-keyword">else</span>
			<span class="js-client-keyword">alert</span><span class="js-bracket">(</span><span class="js-string">&quot;Please select portion..!&quot;</span><span class="js-bracket">)</span>;
	<span class="js-bracket">}</span>

	<span class="js-function-keyword">function</span> saveCropImage<span class="js-bracket">(</span>params<span class="js-bracket">)</span> <span class="js-bracket">{</span>
    jQuery.ajax<span class="js-bracket">(</span><span class="js-bracket">{</span>
        url<span class="js-operator">:</span> siteurl <span class="js-operator">+</span> params<span class="js-bracket">[</span><span class="js-string">'targetUrl'</span><span class="js-bracket">]</span>,
        cache<span class="js-operator">:</span> <span class="js-reserved-keyword">false</span>,
        dataType<span class="js-operator">:</span> <span class="js-string">&quot;html&quot;</span>,
        data<span class="js-operator">:</span> <span class="js-bracket">{</span>
            action<span class="js-operator">:</span> params<span class="js-bracket">[</span><span class="js-string">'action'</span><span class="js-bracket">]</span>,
            id<span class="js-operator">:</span> jQuery<span class="js-bracket">(</span><span class="js-string">'#hdn-profile-id'</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>,
			 t<span class="js-operator">:</span> <span class="js-string">'ajax'</span>,
								w<span class="js-number">1</span><span class="js-operator">:</span>params<span class="js-bracket">[</span><span class="js-string">'thumb_width'</span><span class="js-bracket">]</span>,
								x<span class="js-number">1</span><span class="js-operator">:</span>params<span class="js-bracket">[</span><span class="js-string">'x_axis'</span><span class="js-bracket">]</span>,
								h<span class="js-number">1</span><span class="js-operator">:</span>params<span class="js-bracket">[</span><span class="js-string">'thumb_height'</span><span class="js-bracket">]</span>,
								y<span class="js-number">1</span><span class="js-operator">:</span>params<span class="js-bracket">[</span><span class="js-string">'y_axis'</span><span class="js-bracket">]</span>,
								x<span class="js-number">2</span><span class="js-operator">:</span>params<span class="js-bracket">[</span><span class="js-string">'x2_axis'</span><span class="js-bracket">]</span>,
								y<span class="js-number">2</span><span class="js-operator">:</span>params<span class="js-bracket">[</span><span class="js-string">'y2_axis'</span><span class="js-bracket">]</span>
        <span class="js-bracket">}</span>,
        type<span class="js-operator">:</span> <span class="js-string">'Post'</span>,
       <span class="js-comment">// async:false,
</span>
        success<span class="js-operator">:</span> <span class="js-function-keyword">function</span> <span class="js-bracket">(</span>response<span class="js-bracket">)</span> <span class="js-bracket">{</span>
				jQuery<span class="js-bracket">(</span><span class="js-string">&quot;#changePic&quot;</span><span class="js-bracket">)</span>.hide<span class="js-bracket">(</span><span class="js-bracket">)</span>;
				jQuery<span class="js-bracket">(</span><span class="js-string">&quot;.imgareaselect-border1,.imgareaselect-border2,.imgareaselect-border3,.imgareaselect-border4,.imgareaselect-border2,.imgareaselect-outer&quot;</span><span class="js-bracket">)</span>.css<span class="js-bracket">(</span><span class="js-string">'display'</span>, <span class="js-string">'none'</span><span class="js-bracket">)</span>;

				jQuery<span class="js-bracket">(</span><span class="js-string">&quot;#avatar-edit-img&quot;</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">'src'</span>, response<span class="js-bracket">)</span>;
				jQuery<span class="js-bracket">(</span><span class="js-string">&quot;#preview-avatar-profile&quot;</span><span class="js-bracket">)</span>.html<span class="js-bracket">(</span><span class="js-string">''</span><span class="js-bracket">)</span>;
				jQuery<span class="js-bracket">(</span><span class="js-string">&quot;#photoimg&quot;</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>;
				AlertManager.showNotification<span class="js-bracket">(</span><span class="js-string">'Image cropped!'</span>, <span class="js-string">'Click Save Profile button to save image.'</span>, <span class="js-string">'success'</span><span class="js-bracket">)</span>;

        <span class="js-bracket">}</span>,
        error<span class="js-operator">:</span> <span class="js-function-keyword">function</span> <span class="js-bracket">(</span>xhr, ajaxOptions, thrownError<span class="js-bracket">)</span> <span class="js-bracket">{</span>
            <span class="js-client-keyword">alert</span><span class="js-bracket">(</span><span class="js-string">'status Code:'</span> <span class="js-operator">+</span> xhr.status <span class="js-operator">+</span> <span class="js-string">'Error Message :'</span> <span class="js-operator">+</span> thrownError<span class="js-bracket">)</span>;
        <span class="js-bracket">}</span>
    <span class="js-bracket">}</span><span class="js-bracket">)</span>;
	<span class="js-bracket">}</span></span></pre>
</div>
<p><strong>Step 3:</strong>We will define controller method:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
</pre>
<pre><span class="php"><span class="php-comment">/*********************************************************************
	 Purpose			: update image.
	 Parameters		    : null
	 Returns			: integer
	 ***********************************************************************/</span>
	<span class="php-keyword">public</span> <span class="php-function">function</span> changeAvatar<span class="php-brackets">(</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
		<span class="php-keyword">global</span> <span class="php-var">$current_user</span>;
		<span class="php-var">$loggedInId</span> <span class="php-operator">=</span> <span class="php-var">$current_user</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>ID;
		<span class="php-var">$post</span> <span class="php-operator">=</span> <span class="php-keyword">isset</span><span class="php-brackets">(</span><span class="php-var">$_POST</span><span class="php-brackets">)</span> <span class="php-operator">?</span> <span class="php-var">$_POST</span><span class="php-operator">:</span> <span class="php-keyword">array</span><span class="php-brackets">(</span><span class="php-brackets">)</span>;
		<span class="php-var">$max_width</span> <span class="php-operator">=</span> <span class="php-string">&quot;500&quot;</span>;
		<span class="php-var">$userId</span> <span class="php-operator">=</span> <span class="php-keyword">isset</span><span class="php-brackets">(</span><span class="php-var">$post</span><span class="php-brackets">[</span><span class="php-string">'hdn-profile-id'</span><span class="php-brackets">]</span><span class="php-brackets">)</span> <span class="php-operator">?</span> <span class="php-function">intval</span><span class="php-brackets">(</span><span class="php-var">$post</span><span class="php-brackets">[</span><span class="php-string">'hdn-profile-id'</span><span class="php-brackets">]</span><span class="php-brackets">)</span> <span class="php-operator">:</span> <span class="php-number">0</span>;
		<span class="php-var">$path</span> <span class="php-operator">=</span> get_theme_root<span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-operator">.</span> <span class="php-string">'\images\uploads\tmp'</span>;

		<span class="php-var">$valid_formats</span> <span class="php-operator">=</span> <span class="php-keyword">array</span><span class="php-brackets">(</span><span class="php-string">&quot;jpg&quot;</span>, <span class="php-string">&quot;png&quot;</span>, <span class="php-string">&quot;gif&quot;</span>, <span class="php-string">&quot;bmp&quot;</span>,<span class="php-string">&quot;jpeg&quot;</span><span class="php-brackets">)</span>;
		<span class="php-var">$name</span> <span class="php-operator">=</span> <span class="php-var">$_FILES</span><span class="php-brackets">[</span><span class="php-string">'photoimg'</span><span class="php-brackets">]</span><span class="php-brackets">[</span><span class="php-string">'name'</span><span class="php-brackets">]</span>;
		<span class="php-var">$size</span> <span class="php-operator">=</span> <span class="php-var">$_FILES</span><span class="php-brackets">[</span><span class="php-string">'photoimg'</span><span class="php-brackets">]</span><span class="php-brackets">[</span><span class="php-string">'size'</span><span class="php-brackets">]</span>;
		<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-function">strlen</span><span class="php-brackets">(</span><span class="php-var">$name</span><span class="php-brackets">)</span><span class="php-brackets">)</span>
		<span class="php-brackets">{</span>
		<span class="php-function">list</span><span class="php-brackets">(</span><span class="php-var">$txt</span>, <span class="php-var">$ext</span><span class="php-brackets">)</span> <span class="php-operator">=</span> <span class="php-function">explode</span><span class="php-brackets">(</span><span class="php-string">&quot;.&quot;</span>, <span class="php-var">$name</span><span class="php-brackets">)</span>;
		<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-function">in_array</span><span class="php-brackets">(</span><span class="php-var">$ext</span>,<span class="php-var">$valid_formats</span><span class="php-brackets">)</span><span class="php-brackets">)</span>
		<span class="php-brackets">{</span>
		<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$size</span><span class="php-operator">&lt;</span><span class="php-brackets">(</span><span class="php-number">1</span><span class="php-number">0</span><span class="php-number">2</span><span class="php-number">4</span><span class="php-operator">*</span><span class="php-number">1</span><span class="php-number">0</span><span class="php-number">2</span><span class="php-number">4</span><span class="php-brackets">)</span><span class="php-brackets">)</span> <span class="php-comment">// Image size max 1 MB
</span>
		<span class="php-brackets">{</span>
		<span class="php-var">$actual_image_name</span> <span class="php-operator">=</span> <span class="php-string">'avatar'</span> <span class="php-operator">.</span><span class="php-string">'_'</span><span class="php-operator">.</span><span class="php-var">$userId</span> <span class="php-operator">.</span><span class="php-string">'.'</span><span class="php-operator">.</span><span class="php-var">$ext</span>;
		<span class="php-var">$filePath</span> <span class="php-operator">=</span> <span class="php-var">$path</span> <span class="php-operator">.</span><span class="php-string">'/'</span><span class="php-operator">.</span><span class="php-var">$actual_image_name</span>;
		<span class="php-var">$tmp</span> <span class="php-operator">=</span> <span class="php-var">$_FILES</span><span class="php-brackets">[</span><span class="php-string">'photoimg'</span><span class="php-brackets">]</span><span class="php-brackets">[</span><span class="php-string">'tmp_name'</span><span class="php-brackets">]</span>;

		<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-function">move_uploaded_file</span><span class="php-brackets">(</span><span class="php-var">$tmp</span>, <span class="php-var">$filePath</span><span class="php-brackets">)</span><span class="php-brackets">)</span>
		<span class="php-brackets">{</span>
		<span class="php-var">$width</span> <span class="php-operator">=</span> <span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>getWidth<span class="php-brackets">(</span><span class="php-var">$filePath</span><span class="php-brackets">)</span>;
			<span class="php-var">$height</span> <span class="php-operator">=</span> <span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>getHeight<span class="php-brackets">(</span><span class="php-var">$filePath</span><span class="php-brackets">)</span>;
			<span class="php-comment">//Scale the image if it is greater than the width set above
</span>
			<span class="php-keyword">if</span> <span class="php-brackets">(</span><span class="php-var">$width</span> <span class="php-operator">&gt;</span> <span class="php-var">$max_width</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
				<span class="php-var">$scale</span> <span class="php-operator">=</span> <span class="php-var">$max_width</span><span class="php-operator">/</span><span class="php-var">$width</span>;
				<span class="php-var">$uploaded</span> <span class="php-operator">=</span> <span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>resizeImage<span class="php-brackets">(</span><span class="php-var">$filePath</span>,<span class="php-var">$width</span>,<span class="php-var">$height</span>,<span class="php-var">$scale</span><span class="php-brackets">)</span>;
			<span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
				<span class="php-var">$scale</span> <span class="php-operator">=</span> <span class="php-number">1</span>;
				<span class="php-var">$uploaded</span> <span class="php-operator">=</span> <span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>resizeImage<span class="php-brackets">(</span><span class="php-var">$filePath</span>,<span class="php-var">$width</span>,<span class="php-var">$height</span>,<span class="php-var">$scale</span><span class="php-brackets">)</span>;
			<span class="php-brackets">}</span>
		<span class="php-var">$res</span> <span class="php-operator">=</span> <span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>Profile<span class="php-operator">-</span><span class="php-operator">&gt;</span>saveAvatar<span class="php-brackets">(</span><span class="php-keyword">array</span><span class="php-brackets">(</span>
						<span class="php-string">'userId'</span> <span class="php-operator">=</span><span class="php-operator">&gt;</span> <span class="php-keyword">isset</span><span class="php-brackets">(</span><span class="php-var">$userId</span><span class="php-brackets">)</span> <span class="php-operator">?</span> <span class="php-function">intval</span><span class="php-brackets">(</span><span class="php-var">$userId</span><span class="php-brackets">)</span> <span class="php-operator">:</span> <span class="php-number">0</span>,
												<span class="php-string">'avatar'</span> <span class="php-operator">=</span><span class="php-operator">&gt;</span> <span class="php-keyword">isset</span><span class="php-brackets">(</span><span class="php-var">$actual_image_name</span><span class="php-brackets">)</span> <span class="php-operator">?</span> <span class="php-var">$actual_image_name</span> <span class="php-operator">:</span> <span class="php-string">''</span>,
						<span class="php-brackets">)</span><span class="php-brackets">)</span>;

		<span class="php-comment">//mysql_query(&quot;UPDATE users SET profile_image='$actual_image_name' WHERE uid='$session_id'&quot;);
</span>
		<span class="php-keyword">echo</span> <span class="php-string">&quot;&lt;img id='photo' class='' src='&quot;</span><span class="php-operator">.</span>getCustomAvatar<span class="php-brackets">(</span><span class="php-var">$userId</span>, <span class="php-keyword">true</span><span class="php-brackets">)</span><span class="php-operator">.</span><span class="php-string">'?'</span><span class="php-operator">.</span><span class="php-function">time</span><span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-operator">.</span><span class="php-string">&quot;' class='preview'/&gt;&quot;</span>;
		<span class="php-brackets">}</span>
		<span class="php-keyword">else</span>
		<span class="php-keyword">echo</span> <span class="php-string">&quot;failed&quot;</span>;
		<span class="php-brackets">}</span>
		<span class="php-keyword">else</span>
		<span class="php-keyword">echo</span> <span class="php-string">&quot;Image file size max 1 MB&quot;</span>;
		<span class="php-brackets">}</span>
		<span class="php-keyword">else</span>
		<span class="php-keyword">echo</span> <span class="php-string">&quot;Invalid file format..&quot;</span>;
		<span class="php-brackets">}</span>
		<span class="php-keyword">else</span>
		<span class="php-keyword">echo</span> <span class="php-string">&quot;Please select image..!&quot;</span>;
		<span class="php-function">exit</span>;

	<span class="php-brackets">}</span>
	<span class="php-comment">/*********************************************************************
	 Purpose			: update image.
	 Parameters		    : null
	 Returns			: integer
	 ***********************************************************************/</span>
	<span class="php-keyword">public</span> <span class="php-function">function</span> saveAvatarTmp<span class="php-brackets">(</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
		<span class="php-keyword">global</span> <span class="php-var">$current_user</span>;
		<span class="php-var">$loggedInId</span> <span class="php-operator">=</span> <span class="php-var">$current_user</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>ID;
		<span class="php-var">$post</span> <span class="php-operator">=</span> <span class="php-keyword">isset</span><span class="php-brackets">(</span><span class="php-var">$_POST</span><span class="php-brackets">)</span> <span class="php-operator">?</span> <span class="php-var">$_POST</span><span class="php-operator">:</span> <span class="php-keyword">array</span><span class="php-brackets">(</span><span class="php-brackets">)</span>;
		<span class="php-var">$userId</span> <span class="php-operator">=</span> <span class="php-keyword">isset</span><span class="php-brackets">(</span><span class="php-var">$post</span><span class="php-brackets">[</span><span class="php-string">'id'</span><span class="php-brackets">]</span><span class="php-brackets">)</span> <span class="php-operator">?</span> <span class="php-function">intval</span><span class="php-brackets">(</span><span class="php-var">$post</span><span class="php-brackets">[</span><span class="php-string">'id'</span><span class="php-brackets">]</span><span class="php-brackets">)</span> <span class="php-operator">:</span> <span class="php-number">0</span>;
		<span class="php-var">$path</span> <span class="php-operator">=</span> get_theme_root<span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-operator">.</span> <span class="php-string">'\\images\uploads\tmp'</span>;
		<span class="php-var">$t_width</span> <span class="php-operator">=</span> <span class="php-number">3</span><span class="php-number">0</span><span class="php-number">0</span>;	<span class="php-comment">// Maximum thumbnail width
</span>
		<span class="php-var">$t_height</span> <span class="php-operator">=</span> <span class="php-number">3</span><span class="php-number">0</span><span class="php-number">0</span>;	<span class="php-comment">// Maximum thumbnail height
</span>

	<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-keyword">isset</span><span class="php-brackets">(</span><span class="php-var">$_POST</span><span class="php-brackets">[</span><span class="php-string">'t'</span><span class="php-brackets">]</span><span class="php-brackets">)</span><span class="php-operator"> and </span><span class="php-var">$_POST</span><span class="php-brackets">[</span><span class="php-string">'t'</span><span class="php-brackets">]</span> <span class="php-operator">=</span><span class="php-operator">=</span> <span class="php-string">&quot;ajax&quot;</span><span class="php-brackets">)</span>
	<span class="php-brackets">{</span>
		<span class="php-function">extract</span><span class="php-brackets">(</span><span class="php-var">$_POST</span><span class="php-brackets">)</span>;

		<span class="php-var">$img</span> <span class="php-operator">=</span> get_user_meta<span class="php-brackets">(</span><span class="php-var">$userId</span>, <span class="php-string">'user_avatar'</span>, <span class="php-keyword">true</span><span class="php-brackets">)</span>;
		<span class="php-var">$imagePath</span> <span class="php-operator">=</span> <span class="php-var">$path</span><span class="php-operator">.</span><span class="php-string">'/'</span><span class="php-operator">.</span><span class="php-var">$img</span>;
		<span class="php-var">$ratio</span> <span class="php-operator">=</span> <span class="php-brackets">(</span><span class="php-var">$t_width</span><span class="php-operator">/</span><span class="php-var">$w1</span><span class="php-brackets">)</span>;
		<span class="php-var">$nw</span> <span class="php-operator">=</span> <span class="php-function">ceil</span><span class="php-brackets">(</span><span class="php-var">$w1</span> <span class="php-operator">*</span> <span class="php-var">$ratio</span><span class="php-brackets">)</span>;
		<span class="php-var">$nh</span> <span class="php-operator">=</span> <span class="php-function">ceil</span><span class="php-brackets">(</span><span class="php-var">$h1</span> <span class="php-operator">*</span> <span class="php-var">$ratio</span><span class="php-brackets">)</span>;
		<span class="php-var">$nimg</span> <span class="php-operator">=</span> <span class="php-function">imagecreatetruecolor</span><span class="php-brackets">(</span><span class="php-var">$nw</span>,<span class="php-var">$nh</span><span class="php-brackets">)</span>;
		<span class="php-var">$im_src</span> <span class="php-operator">=</span> <span class="php-function">imagecreatefromjpeg</span><span class="php-brackets">(</span><span class="php-var">$imagePath</span><span class="php-brackets">)</span>;
		<span class="php-function">imagecopyresampled</span><span class="php-brackets">(</span><span class="php-var">$nimg</span>,<span class="php-var">$im_src</span>,<span class="php-number">0</span>,<span class="php-number">0</span>,<span class="php-var">$x1</span>,<span class="php-var">$y1</span>,<span class="php-var">$nw</span>,<span class="php-var">$nh</span>,<span class="php-var">$w1</span>,<span class="php-var">$h1</span><span class="php-brackets">)</span>;
		<span class="php-function">imagejpeg</span><span class="php-brackets">(</span><span class="php-var">$nimg</span>,<span class="php-var">$imagePath</span>,<span class="php-number">9</span><span class="php-number">0</span><span class="php-brackets">)</span>;

	<span class="php-brackets">}</span>
	<span class="php-keyword">echo</span> getCustomAvatar<span class="php-brackets">(</span><span class="php-var">$userId</span>, <span class="php-keyword">true</span><span class="php-brackets">)</span>;
	<span class="php-function">exit</span><span class="php-brackets">(</span><span class="php-number">0</span><span class="php-brackets">)</span>;
	<span class="php-brackets">}</span>

	<span class="php-comment">/*********************************************************************
	 Purpose			: resize image.
	 Parameters		    : null
	 Returns			: image
	 ***********************************************************************/</span>
	<span class="php-function">function</span> resizeImage<span class="php-brackets">(</span><span class="php-var">$image</span>,<span class="php-var">$width</span>,<span class="php-var">$height</span>,<span class="php-var">$scale</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
	<span class="php-var">$newImageWidth</span> <span class="php-operator">=</span> <span class="php-function">ceil</span><span class="php-brackets">(</span><span class="php-var">$width</span> <span class="php-operator">*</span> <span class="php-var">$scale</span><span class="php-brackets">)</span>;
	<span class="php-var">$newImageHeight</span> <span class="php-operator">=</span> <span class="php-function">ceil</span><span class="php-brackets">(</span><span class="php-var">$height</span> <span class="php-operator">*</span> <span class="php-var">$scale</span><span class="php-brackets">)</span>;
	<span class="php-var">$newImage</span> <span class="php-operator">=</span> <span class="php-function">imagecreatetruecolor</span><span class="php-brackets">(</span><span class="php-var">$newImageWidth</span>,<span class="php-var">$newImageHeight</span><span class="php-brackets">)</span>;
	<span class="php-var">$source</span> <span class="php-operator">=</span> <span class="php-function">imagecreatefromjpeg</span><span class="php-brackets">(</span><span class="php-var">$image</span><span class="php-brackets">)</span>;
	<span class="php-function">imagecopyresampled</span><span class="php-brackets">(</span><span class="php-var">$newImage</span>,<span class="php-var">$source</span>,<span class="php-number">0</span>,<span class="php-number">0</span>,<span class="php-number">0</span>,<span class="php-number">0</span>,<span class="php-var">$newImageWidth</span>,<span class="php-var">$newImageHeight</span>,<span class="php-var">$width</span>,<span class="php-var">$height</span><span class="php-brackets">)</span>;
	<span class="php-function">imagejpeg</span><span class="php-brackets">(</span><span class="php-var">$newImage</span>,<span class="php-var">$image</span>,<span class="php-number">9</span><span class="php-number">0</span><span class="php-brackets">)</span>;
	<span class="php-function">chmod</span><span class="php-brackets">(</span><span class="php-var">$image</span>, <span class="php-number">0</span><span class="php-number">7</span><span class="php-number">7</span><span class="php-number">7</span><span class="php-brackets">)</span>;
	<span class="php-keyword">return</span> <span class="php-var">$image</span>;
<span class="php-brackets">}</span>
<span class="php-comment">/*********************************************************************
	 Purpose			: get image height.
	 Parameters		    : null
	 Returns			: height
	 ***********************************************************************/</span>
<span class="php-function">function</span> getHeight<span class="php-brackets">(</span><span class="php-var">$image</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
	<span class="php-var">$sizes</span> <span class="php-operator">=</span> <span class="php-function">getimagesize</span><span class="php-brackets">(</span><span class="php-var">$image</span><span class="php-brackets">)</span>;
	<span class="php-var">$height</span> <span class="php-operator">=</span> <span class="php-var">$sizes</span><span class="php-brackets">[</span><span class="php-number">1</span><span class="php-brackets">]</span>;
	<span class="php-keyword">return</span> <span class="php-var">$height</span>;
<span class="php-brackets">}</span>
<span class="php-comment">/*********************************************************************
	 Purpose			: get image width.
	 Parameters		    : null
	 Returns			: width
	 ***********************************************************************/</span>
<span class="php-function">function</span> getWidth<span class="php-brackets">(</span><span class="php-var">$image</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
	<span class="php-var">$sizes</span> <span class="php-operator">=</span> <span class="php-function">getimagesize</span><span class="php-brackets">(</span><span class="php-var">$image</span><span class="php-brackets">)</span>;
	<span class="php-var">$width</span> <span class="php-operator">=</span> <span class="php-var">$sizes</span><span class="php-brackets">[</span><span class="php-number">0</span><span class="php-brackets">]</span>;
	<span class="php-keyword">return</span> <span class="php-var">$width</span>;
<span class="php-brackets">}</span></span></pre>
</div>
<p><strong>Step 4:</strong> Model method to save image path into database.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre>
<pre><span class="php"><span class="php-comment">/*********************************************************************
	 Purpose			: save avatar.
	 Parameters		    : $options
	 Returns			: true/false
	 ***********************************************************************/</span>
	<span class="php-function">function</span> saveAvatar<span class="php-brackets">(</span><span class="php-var">$options</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
  		<span class="php-comment">//update sql
</span>

  	<span class="php-brackets">}</span></span></pre>
</div>
<h4 class="label label-success">Result</h4>
<p><img src="http://phpflow.com/wp-content/uploads/2013/04/crop.png" alt="" title="crop" width="581" height="515" class="aligncenter size-full wp-image-2265" /></p>
]]></content:encoded>
			<wfw:commentRss>http://phpflow.com/php/image-crop-functionality-in-model-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
