Solution To WordPress getimagesize() Error

If you’ve for whatever reason noticed that your WordPress website is generating errors similar to the following then I may have a solution for you.

Warning: getimagesize(/home/.some-dir/example.com/folder/httpd.www/wp-content/uploads/some-image.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/.some-dir/example.com/folder/httpd.www/wp-content/blah/blah/blah.php on line 123

I noticed that some pages that generated image information were printing errors out on my pages with private server file structures included. Generally you don’t want to see this printed out to the public. ;)

I’m not guaranteeing a fix for you, but rather what worked for me.

If you are getting an error link the one that I’ve listed above, more specifically the “failed to open stream: No such file or directory,” then you may be about to fix it in only a few minor steps.

Things you will need:

  • FTP (I use FileZilla)
  • phpMyAdmin
  • Ability to add a new plugin to your site
  • Patience

Procedure

Single quotes must be the normal ascii quotes. Chances are, if you copy and paste from my blog, they will be the wrong type so double check that as it could give you problems. ;)

  1. First and foremost, make sure to backup your entire database to a safe place. I’m not liable in the case that you don’t backup your database and this procedure borks your blog (or any other case for that matter). ;)
  2. Create a new file named “abstest.php” and upload it to your blog’s root directory after entering the following code into it:
    <?php define('ABSPATH', dirname(__FILE__).'/'); echo ABSPATH; ?>
  3. Open a new browser tab and navigate to “http://www.your-website.com/abstest.php“. You should find a short page with the printout of your servers absolute path.
  4. Check that the path provided by this test file matches the base path printed out by the getimagesize() error exactly. In my case, my server had changed slightly so the differences were similar to the following:
    /home/.some-dir/example.com/folder/httpd.www/
    /home/example.com/folder/httpd.www/
  5. If you find a mismatch, then you’ve found your problem and the rest is simple. If not, then my tips will most likely not solve your particular WordPress error(s).
  6. If you’ve found a mismatch, then continue: Open a new browser tab and navigate to your phpMyAdmin interface. Select your WordPress database, then click Search. I searched all tables for a match of the path that was different, in my case it was “.some-dir/“.
  7. If there are matches found then you need to click the SQL tab at the top (preferably in a new tab) and paste the following (making sure to edit it to match the table and fields you need) and run it to find and replace that changed part of the path.
    update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);
    For more information on SQL find and replace, either search Google or read this.
  8. After replacing all of the affected tables and strings, your images should be properly address. You’re not done yet though.
  9. Open WordPress Plugins and add/install a plugin named “Regenerate Thumbnails“. After installing it, make sure to activate it. ;)
  10. In your Admin panel, find the Tools menu and expand it. You should see a menu item labeled “Regen. Thumbnails”…click it. This will open a page with a start button. Clicking this button will begin the process of correcting your thumbnail dimensions as well as other metadata. It will take some time depending on the number of thumbnails you have accumulated.
  11. After the progress bar reaches 100% it will notify you that it is complete. You’re all done! You may need to clear your cache to refresh any pages that still generate the previous error message.

If you had any problems with the above mentioned procedure, I would suggest restoring your database using your backup copy and either trying again, paying someone to do it for you or just forgetting about it. ;)

If it works then great! If not then sorry you’ve wasted your time. It worked for me, so maybe it will work for you as well. :D

WP-TwitterBadge v0.2 Released

After taking some time to track down a bug that seems to only affect Internet Explorer 6 (why on earth did I bother?) I’ve finally released an update that fixes the error.

After getting several comments about users experiencing errors with this plugin while using IE6 I finally gave in and patched the little bug. Why are they still using IE6?

…well, it works fine now…as far as I know. I’ve had a few people test it with no errors as well as myself, so hopefully if you couldn’t use it before it will work fine now.

To find out more about this WordPress plugin, go to it’s main page. You will find all released versions there (past and present) as well as a link to the official WordPress Plugin page. Feel free to leave feedback!

WP-UserAgent v0.9 Released

I’ve just released an update for the WordPress plugin WP-UserAgent. The update changelog is as follows:

v0.9

  • Added detection for Venenux GNU Linux and Oracle Linux.
  • Added detection for Laconica and MovableType trackbacks.
  • Cleaned some of the code for trackback detections.

You can find out more about WP-UserAgent as well as a download from the main page.

New WordPress Twitter Badge Plugin!

wp-twitterbadge-01

After coming across this nifty little Twitter Badge at Techie-Buzz while reading a Google Chrome OS article, I realized how cool their little Twitter link was and I instantly new it was going to be on kyleabaker.com as well. :D

wp-twitterbadge-01

After a quick look at the source code of the page, I had decided to build a quick plugin for WordPress to insert the same code. So the plugin process began.

I didn’t want to hard code it into the footer of my K2 theme, because I frequently update to the latest K2 theme nightly builds. This way would save me a lot of trouble and even make this neat little Twitter Badge available to thousands. And so…WP-TwitterBadge was born.

wp-twitterbadge-02

I traced the code back to an embeded script from go2web20.net and realized how n00b friendly this script would have been to install anyway even without an easier plugin to install it for you, but the fact that it would save me time in the future was well worth it.

Basically, if you’re not using the WordPress plugin, you just link the script and set a few variables. This made it very easy to make it customizable as well!

Just mimicking their own setup page, I was able to make a quick Options page featuring a live preview (as all of my plugins have so far ;) ). I even coded the preview with way less script than they used on their own page since extreme error checking is really not needed (everything is live so you can see the problems there).

wp-twitterbadge-03

At a rate of 20-30+ new downloads per hour I would say that this plugin is by far my most favored project…considering that it hasn’t been reviewed yet (no trackbacks thus far) by anyone whereas others already have.

If you’d like to checkout this little Twitter Badge on your own site, just head over to the plugin page or search for “WP-TwitterBadge” from your “Add New Plugins” page in WordPress and install it from there. If you like it, pass it on!

WordPress Plugin WP-UserAgent 0.8

wp-useragent-0-8-img1

I’ve just updated WP-UserAgent to version 0.8, covering a lot of ground over the past few days. As I’m working to reach a stable and solid 1.0 release, I’m also working towards a feature complete plugin.

Version 0.8 offers support for detecting ~90 different web browsers and ~35 different operating systems (counting each version of windows).

wp-useragent-0-8-img1

Easy access to WP-UserAgent settings is worked right into the Plugins page. No more need to search for options to edit!

Once you find the options page, you’ll find a cleaned up look and feel, along with a real-time preview of how your changes will appear.

wp-useragent-0-8-img2

If you’re in need of a cool geeky WordPress plugin, why not give WP-UserAgent a shot? It’s an interesting way to find out a few details about your subscribers and other visitors!

Find out more details, changelogs and downloads on the official WP-UserAgent plugin page.

WordPress 2.7.1 Released

A revision update to WordPress 2.7 has been released today with 68 fixed tickets!

As usual I immediately upgraded my version of WordPress. The upgrade is now as simple as Clicking an upgrade button and ta-da!

If you want to upgrade your version of WordPress 2.7 to 2.7.1, then just open your WordPress admin section. Under the “Tools” menu you will find an “Upgrade” option. Click “Upgrade” and on the next page just click to automatically upgrade!

It is still suggested that you backup your database, however, I ran into no problems during my upgrade process and the entire upgrade took approximately 5 seconds.

For those of you using a version of WordPress prior to 2.7, you will not have the luxury of a built-in automatic update, but you can still use a plugin to automatically upgrade for you. Just make sure to deactivate the plugin later if you intend to use the built-in upgrade tool in the future, otherwise you will see a message similar to the following when attempting to upgrade:

Fatal error: Cannot redeclare class pclzip in /../wp-admin/includes/class-pclzip.php on line 171

Enjoy the easy upgrade tool and WordPress 2.7.1!

WordPress 2.7 installed now

I’ve finished installing WordPress 2.7 and inspecting the major changes to the administration panel. I must say I’m very impressed.

Although the administration panel is arranged and appears very different from 2.6.5, it is arranged in a way that makes more sense and gives you faster access to the things you want to do.

For instance, the drop down menus on the left can show or hide more links for things such as adding a new post, adding a new page, viewing your settings or plugins. This allows for faster navigation by giving you more direct links while keeping them out of your way when needed and fewer page loads to get there.

Another really cool design feature is that the menu on the left can be minimized to an icon state. Hovering the icons for each category reveals a pop-out menu with more links.

WordPress 2.7 also sports it’s own updating system, so the WordPress Automatic Update plugin that was developed by a third-party is no longer a necessity. Obviously I have not had a chance yet to test the built-in upgrade tool (since there have been no updates since 2.7 ;) ), but I will be trusting it with my next WordPress update for sure.

With most pages you are given a tab at the top of the page titled “Screen Options”. You can click this tab to view a short list of items that you can check or uncheck to show or hide respectively on the page. If you never use the “Custom Fields” section for Posts or Pages then you can uncheck it and you won’t have to look at it any longer or have it clutter your workspace!

It appears that most all sections or elements in the administration panel are collapsible to clean up or provide more space. Elements in the Dashboard and other various pages are now drag and drop arrangeable. A new “QuickPress” section is available for a really simple, short and quick post. I may find myself using it fairly often, however, most of the time my posts are a bit lengthy. :P

Overall I think the changes and improvements far out way the temporary lack of familiarity in the administration panel. It won’t take you very long at all to readjust and see how much better it is!

Hope everyone is looking into upgrading and if you want to make your life easier then you can use the WordPress Automatic Upgrade plugin that I mentioned earlier. You won’t need it ever again once you upgrade to 2.7, but unless you want to open up your ftp client and manually upgrade that way then you’ll probably want to use the plugin. ;)

Enjoy!

WordPress 2.7 Now Available!

WordPress 2.7 is now (finally) available!

The first thing you’ll notice about 2.7 is its new interface. From the top down, we’ve listened to your feedback and thought deeply about the design and the result is a WordPress that’s just plain faster. Nearly every task you do on your blog will take fewer clicks and be faster in 2.7 than it did in a previous version. (Download it now, or read on for more.)

Next you’ll begin to notice the new features subtly sprinkled through the new interface: the new dashboard that you can arrange with drag and drop to put the things most important to you on top, QuickPress, comment threading, paging, and the ability to reply to comments from your dashboard, the ability to install any plugin directly from WordPress.org with a single click, and sticky posts.

Digging in further you might notice that every screen is customizable. Let’s say you never care about author on your post listings — just click “Screen Options” and uncheck it and it’s instantly gone from the page. The same for any module on the dashboard or write screen. If your screen is narrow and the menu is taking up too much horizontal room, click the arrow to minimize it to be icon-only, and then go to the write page and drag and drop everything from the right column into the main one, so your posting area is full-screen. (For example I like hiding everything except categories, tags, and publish. I put categories and tags on the right, and publish under the post box.)

Source: http://wordpress.org/development/2008/12/coltrane/

Nice surprise today with blog hits.

kyleabaker-com-blog-stats-2008-12-10

As always, at the end of the day I check my blog stats to see where my traffic is coming from and what content is catching the most attention. I was certainly surprised today to see that I got a new all time hit count in blog hits.

For some reason WordPress stats stop counting here at 8:00 pm EST. I guess it’s some setting in my WordPress account or something and I just haven’t gotten around to looking into it yet. Ah well.

Just one of those random spikes in traffic I suppose, but I’ll take it. :P

Looks like tomorrow could be the same with 12 hits in 15 minutes (at time of taking screenshot of course). Hopefully I’m gaining some credibility on the web. Who knows.