<?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>Rob Yardman &#187; PHP Programming</title>
	<atom:link href="http://www.robyardman.com/category/php-programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.robyardman.com</link>
	<description>Switching gears in life...</description>
	<lastBuildDate>Tue, 07 Feb 2012 21:17:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Controlling Image Sizes In WordPress</title>
		<link>http://www.robyardman.com/wordpress/controlling-image-sizes-in-wordpress?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=controlling-image-sizes-in-wordpress</link>
		<comments>http://www.robyardman.com/wordpress/controlling-image-sizes-in-wordpress#comments</comments>
		<pubDate>Fri, 26 Mar 2010 02:55:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Clients]]></category>
		<category><![CDATA[Beginning WordPress]]></category>
		<category><![CDATA[CMS Image Control]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Wordpress Client]]></category>
		<category><![CDATA[Wordpress Designer]]></category>
		<category><![CDATA[Wordpress Image Control]]></category>
		<category><![CDATA[Wordpress Images]]></category>
		<category><![CDATA[WordPress Theme]]></category>
		<category><![CDATA[WordPress Theming]]></category>

		<guid isPermaLink="false">http://www.robyardman.com/?p=464</guid>
		<description><![CDATA[When building a Content Management System for a client, one of the main concerns for a designer is image sizes. If your client is going to be uploading and inserting images into their pages and blog posts then you want the integrity of the design to remain intact; while still allowing your client the freedom [...]
Related posts:<ol>
<li><a href='http://www.robyardman.com/news/wordpress-client-the-santa-fe-vip' rel='bookmark' title='WordPress Client: The Santa Fe VIP'>WordPress Client: The Santa Fe VIP</a></li>
<li><a href='http://www.robyardman.com/wordpress/more-into-wordpress-vs-joomla-and-a-new-rob-theme' rel='bookmark' title='More WordPress Vs. Joomla and a New Theme'>More WordPress Vs. Joomla and a New Theme</a></li>
<li><a href='http://www.robyardman.com/news/design-inspiration-education' rel='bookmark' title='Design, Inspiration &amp; Education'>Design, Inspiration &#038; Education</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.robyardman.com/wp-content/uploads/2010/03/image-width.jpg" rel="lightbox[464]"><img class="alignright size-full wp-image-470" title="image-width" src="http://www.robyardman.com/wp-content/uploads/2010/03/image-width.jpg" alt="" width="150" height="150" /></a>When building a Content Management System for a client, one of the main concerns for a designer is image sizes. If your client is going to be uploading and inserting images into their pages and blog posts then you want the integrity of the design to remain intact; while still allowing your client the freedom to post media without the concern of breaking stuff.</p>
<p>No one wants to open their web page only to see that a huge, or mis-managed, image has pushed content off to the side and completely damaged any credibility of the website to its current or potential readers. Typically this isn&#8217;t due to a lack of caring by the author. It&#8217;s usually an issue of content providers not understanding the complexities of image sizes and resolutions in relation to web design an content authoring.<span id="more-464"></span></p>
<p>This problem came to me during a recent project where my client was posting images and content on a daily basis. I needed a way to constrain the pixel size of images that were being uploading to the server and into articles. I found myself spending a great deal of time re-editing and re-inserting images that were being published way too large. It became a tedious problem after a while and I needed a solution that would benefit me and still give my client the comfort of knowing he wasn&#8217;t damaging his own website.</p>
<h2>The Easy Way Out</h2>
<p>Okay, so there is a simple CSS trick ( <span class="span-code" style="color: #ff6600;">img { max-width: 500px; }</span> ) that you can use to fix this problem. Using CSS width limits on &#8220;img&#8221; html tags will constrain the maximum width an image is displayed in the browser. However, this approach is a little funky and the image isn&#8217;t actually optimized at the specified width. It&#8217;s only scaled down, or &#8220;squeezed&#8221; by the browser, so it&#8217;s still not an ideal solution because you&#8217;re rendering an image that&#8217;s at a resolution way too large for web optimization. I needed a solution that would re-optimize the image to fit into the content space and be at a resolution that&#8217;s suitable for web publishing.</p>
<p>After a couple days of research I found a WordPress extention and an easy code hack that could help me get what I needed.</p>
<h2>My Requirements</h2>
<p>First of all, I want the maximum size of the image uploaded onto the web server to be no larger than 980 pixels in width. This is an optimal image size that will display a perfectly proportioned image when its thumbnail is clicked. A full sized picture is displayed by Lightbox that&#8217;s not larger than the width of the web page (1,010 pixels wide).</p>
<p>In order to achieve this I installed <a title="Resize At Upload Plus" href="http://wordpress.org/extend/plugins/resize-at-upload-plus/">Resize at Upload Plus</a> through the WordPress plugin library. This plugin was written by Daniel Mores and A. Huizingais. It lets you set the maximum size an image can be uploaded onto the web server. If the image is larger than that maximum size, the plugin resizes it to whatever size and width you specify. It&#8217;s a really sweet and simple plugin and something I would hope to see built into WordPress in future updates.</p>
<p style="text-align: center;"><a href="http://www.robyardman.com/wp-content/uploads/2010/03/resize-at-upload.png" rel="lightbox[464]"><img class="aligncenter size-medium wp-image-485" title="Resize At Upload Screen" src="http://www.robyardman.com/wp-content/uploads/2010/03/resize-at-upload-300x165.png" alt="" width="300" height="165" /></a></p>
<p><a title="Resize At Upload Plus" href="http://wordpress.org/extend/plugins/resize-at-upload-plus/">Resize at Upload Plus</a> solves a lot for me. Now my client can upload images directly from his digital camera or computer and not have to worry about the physical pixel size of the image.</p>
<p>Before I had him resizing his images in Photoshop before uploading and publishing them. Now my server doesn&#8217;t take such a huge hit with the giant images that were once being uploaded onto it and I&#8217;m not having to spend valuable time to go back and correct these image size issues.</p>
<p>The next part of the problem could be solved natively in WordPress without needing an extension or plugin. WordPress lets content contributors insert images at four different specified sizes: &#8220;Thumbnail Size,&#8221; &#8220;Medium Size,&#8221; &#8220;Large Size,&#8221; and &#8220;Full Size.&#8221; Although the intermediate sizes of the image can be constrained, the &#8220;Full Size&#8221; image option is still going to be a problem since it allows the author to insert an image at a width up to 980 pixels.</p>
<p>In the &#8220;Media&#8221; section I set the &#8220;Thumbnail Size&#8221;, &#8220;Medium Size&#8221; and &#8220;Large Size&#8221; accordingly to fit the content column so that the image would not be larger than it. That was pretty easy.</p>
<p style="text-align: center;"><a href="http://www.robyardman.com/wp-content/uploads/2010/03/media-settings.png" rel="lightbox[464]"><img class="aligncenter size-medium wp-image-489" title="Media Settings" src="http://www.robyardman.com/wp-content/uploads/2010/03/media-settings-300x173.png" alt="" width="300" height="173" /></a></p>
<p>Having solved that problem there was one more item left to address&#8230;</p>
<h2>Solving the &#8220;Full Size&#8221; Problem</h2>
<p>The next problem I was dealing with is that the &#8220;Add Image&#8221; dialog was still allowing the content author the ability to insert an image at its full size of up to 980 pixels.</p>
<p style="text-align: center;"><a href="http://www.robyardman.com/wp-content/uploads/2010/03/add-image.png" rel="lightbox[464]"><img class="aligncenter size-medium wp-image-490" title="Add Image" src="http://www.robyardman.com/wp-content/uploads/2010/03/add-image-300x194.png" alt="" width="300" height="194" /></a></p>
<p>I don&#8217;t want &#8220;Full Size&#8221; to be an option available to the author. It gives them the opportunity to make the mistake of selecting &#8220;Full Size&#8221; and inserting a 980 pixel wide image into an article. Which in effect would break the theme and defeat the purpose of limitations and constraints.</p>
<p>The easiest way to solve this is to disable the code that displays the &#8220;Full Size&#8221; option. Although considered a &#8220;hack&#8221; to the core WordPress files it solves my problem. The particular portion of code we need to disable is located in the <span class="span-code" style="color: #ff6600;">/wp-admin/includes/media.php</span> file on line 822.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$size_names</span> <span style="color: #339933;">=</span>
	<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
		<span style="color: #0000ff;">'thumbnail'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Thumbnail'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'medium'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Medium'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'large'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Large'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'full'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Full size'</span><span style="color: #009900;">&#41;</span>
&nbsp;
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Change to:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$size_names</span> <span style="color: #339933;">=</span>
	<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
		<span style="color: #0000ff;">'thumbnail'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Thumbnail'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'medium'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Medium'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'large'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Large'</span><span style="color: #009900;">&#41;</span><span style="color: #666666; font-style: italic;">/*,
		'full' =&amp;gt; __('Full size')*/</span>
&nbsp;
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Next, save and upload the media.php file to the server, and the option to insert &#8220;Full Size&#8221; images has been removed and is no longer available to the author.</p>
<p><a href="http://www.robyardman.com/wp-content/uploads/2010/03/removed-fullsize.png" rel="lightbox[464]"><img class="aligncenter size-medium wp-image-504" title="removed-fullsize" src="http://www.robyardman.com/wp-content/uploads/2010/03/removed-fullsize-300x95.png" alt="" width="300" height="95" /></a>That&#8217;s it. The fix is as simple as installing an extension and a change to the core admin media.php file.</p>
<p>The only remaining problem with this &#8220;hack&#8221; is that if you ever update WordPress you may need to go back and comment out the &#8220;Full Size&#8221; code again. Other than that, there should be no problems for you or your client. You no longer have to sit with the thought of images breaking your theme and your client is happy with their ability to edit and contribute to their website. Win &#8211; Win situation.</p>
<p style="text-align: center;">
<p>Related posts:<ol>
<li><a href='http://www.robyardman.com/news/wordpress-client-the-santa-fe-vip' rel='bookmark' title='WordPress Client: The Santa Fe VIP'>WordPress Client: The Santa Fe VIP</a></li>
<li><a href='http://www.robyardman.com/wordpress/more-into-wordpress-vs-joomla-and-a-new-rob-theme' rel='bookmark' title='More WordPress Vs. Joomla and a New Theme'>More WordPress Vs. Joomla and a New Theme</a></li>
<li><a href='http://www.robyardman.com/news/design-inspiration-education' rel='bookmark' title='Design, Inspiration &amp; Education'>Design, Inspiration &#038; Education</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.robyardman.com/wordpress/controlling-image-sizes-in-wordpress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend PHP I: Foundations; A Review</title>
		<link>http://www.robyardman.com/php-programming/zend-php-foundations?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=zend-php-foundations</link>
		<comments>http://www.robyardman.com/php-programming/zend-php-foundations#comments</comments>
		<pubDate>Fri, 24 Apr 2009 21:57:08 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[PHP Foundations]]></category>
		<category><![CDATA[PHP Training]]></category>
		<category><![CDATA[Zend PHP]]></category>
		<category><![CDATA[Zend Training]]></category>

		<guid isPermaLink="false">http://www.robyardman.com/?p=148</guid>
		<description><![CDATA[Today I finished my Zend PHP I: Foundations training course. It was a very informative introductory course on the basics all the way up to mid level PHP programming principals. Okay, well maybe it wasn&#8217;t that advanced but it was a good, challenging guide for someone with a basic knowledge of PHP. For someone like [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Today I finished my <a title="Zend PHP I Foundations" href="http://www.zend.com/en/services/training/course-catalog/php-foundations">Zend PHP I: Foundations</a> training course. It was a very informative introductory course on the basics all the way up to mid level PHP programming principals. Okay, well maybe it wasn&#8217;t <em>that</em> advanced but it was a good, challenging guide for someone with a basic knowledge of PHP.</p>
<p style="text-align: center;"><a href="http://www.robyardman.com/wp-content/uploads/2009/04/zend_certificate.jpg" rel="lightbox[148]"><img class="alignnone size-full wp-image-183" title="Zend PHP Certificate" src="http://www.robyardman.com/wp-content/uploads/2009/04/zend_certificate.jpg" alt="Zend PHP Certificate" width="450" height="308" /></a></p>
<p>For someone like myself who isn&#8217;t exactly a &#8220;qualified&#8221; programmer <strong>yet</strong>, this was a good place to start. I&#8217;m pretty much able to make my way around PHP applications and customize or edit code on my own but I do have my limitations and that was hard to realize while taking this course. I have built my own simple applications but nothing to the level of the programmers around me where I work. Taking this course helped me understand my detachment and the things I need to work on in order to improve myself to get to the level that I want to be as a PHP programmer.</p>
<p>Some of the things we covered were your basic syntax elements, data types, strings and how to represent your code with indentation, spacing and comments. We covered establishing variables and defining arrays along with what to do with all that data and how PHP can parse and render that data into a web application or HTML. We also covered turning basic programming principles and scripts into working functions and the process of defining functions. These are all basic elements of programming and can translate into all programming languages; not just PHP.</p>
<p>Our instructor, <a title="Clark Everetts" href="http://www.everettsconsulting.com/">Clark Everetts</a>, discussed best practice principles and how to go about planning and executing the process of building a web application. During the course we used a basic Black Jack web application game as an example to cover all the elements we would discuss in the class. Clark also provided us with a multitude of examples that were very useful and helped me out a lot.</p>
<p>The most difficult part of the course was the means in which you attend. It would seem quite convenient to attend a class over the web in the comforts of your own office or home. For my particular situation there was a lot of distractions and following along was frustrating sometimes. It&#8217;s very easy to lose you&#8217;re train of thought or wonder off into &#8220;la-la&#8221; land. There is that disconnection of not physically being in a class listening to an instructor where all your attention is on what he or she is saying. Not to mention the stern look you get when you start taking to the people around you.</p>
<p>To take the class you login to a WebEx conference with you, your instructor and your peers. If you have the proper equipment, you can listen to the conference/class on your computer or a telephone. WebEx does allow you to dial into conferences via a standard land line telephone. My personal setup was through my BlackBerry Storm tethered to my Motorola S9 BlueTooth headset.</p>
<p>Overall, I liked taking this course. It was an eye opener and helped me evaluate myself. I think there was so much information to cover that it was somewhat of a race to get everything in. At times I really felt like I was cramming for an exam. Which is understandable because (although unsaid) it is assumed that if you&#8217;re taking this course you do have some background in PHP. If you don&#8217;t I would suggest trying a different route and possibly picking up a beginners book.</p>
<p>My next step after taking this course is to read up on PHP and get my hands dirty with some projects of my own. I&#8217;ll be taking the <a title="Zend PHP II Higher Structures" href="http://www.zend.com/en/services/training/course-catalog/higher-structures-of-php">PHP II: Higher Structures</a> training course from Zend in June so by that time I hope to have a better grasp on the subject.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.robyardman.com/php-programming/zend-php-foundations/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

