Kevin Pirnie' Articles
- Home / Kevin Pirnie’s Articles
By: Kevin On: July 2, 2014
Posted In: Development Hosting MySQL PHP Plugins Theme Development Updates Wordpress design practices development php speed up the web web development wordpress wordpress performance
Post revisions This is a weakness of WordPress. On this site there are over 30,000 revisions for the 14,000 posts. That makes the table bigger and it's slower to search in it. WordPress users realized this three years ago. Tip #1 We backed up the the wp_posts table and then used a simple MySQL command to remove old post revisions. This decreased the table size from 400MB to 120MB: DELETE FROM `wp_posts` WHERE post_type = 'revision' AND post_date NOT LIKE '2012-%' Long-term solution There are WordPress plugins which can limit the number of revisions per post. We think that the WordPress code should be improved and the revisions should be stored in a different table to maximize speed. You can support this on WordPress bug… Read MoreBy: Kevin On: January 22, 2014
Posted In: Development Graphics PHP Software Source Code compression design practices development php speed up the web web development
Need a good way to resize your uploaded image? While keeping the height/width ratio? Why would you need to do this? Well, like most of you, I did not need to keep full sized images that I upload on page, and needed a good way to create thumbnails, and resize the originals down to a more manageable, more web friendly size. This will do the trick... no words of caution, no instructions, just code... use it how you like :) <?php function ResizeImage($inputFile, $filepath, $ext, $maxWidth, $maxHeight){ /* Get some details about the image */ $srcDetails = getimagesize($inputFile); switch ($srcDetails[2]) { case 1: //GIF $source_image = imagecreatefromgif($inputFile); break; case 2: //JPEG $source_image = imagecreatefromjpeg($inputFile); break; case 3: //PNG $source_image = imagecreatefrompng($inputFile); break; case 6: //WBMP… Read MoreBy: Kevin On: January 6, 2014
Posted In: Development ModX PHP Software Source Code development modx php web development
I found myself needing a really simple way to pull in my sites menu, but also wanted the ability to have some placeholders for the links as well. The following code should be created as a snippet, and called un-cached [[!YOUR_SNIPPET_NAME]] What's it do? Well, simply put it generates a navigation block, and throws all your ModX site page links into a hierarchal un-ordered list of link items. As well, as generates a bunch of dynamic placeholders in case you have a need for them. Note: the snippet needs to be called, prior to placing any placeholders in your content. How Do I Use This? Create your template or page and place the following snippet call (make sure to replace YOUR_SNIPPET_NAME, with whatever you named… Read MoreBy: Kevin On: December 11, 2013
Posted In: .Net C# Development Security Software Software Source Code SQL Server SQL Server .net c# development hosting mssql mysql web development web hosting
UPDATE 2.0!!! Wow, just realized it's been awhile since i posted anything... well kiddies, time for some new code. Although I have grown up loveing, carressing, and mutilating Visual Basic, I have decided to take a stab at some C# since most of my projects lately have comes across in the form of PHP. While I do love VB still, I am starting to fall hard for some C# sexyness (<- spelling). I have a VB version of what I am about to post as well, and though the language structure is different, there really aren't very many differences between the 2. I thought I may get some sort of performance boost out of this "conversion" but alas, I was mistaken. Both languages performed admirably… Read More