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

UserJS: Twitter-Rounded

I’ve thrown together a quick script for Opera that you can use if you’d like to see rounded corners (aka border-radius). It seems that Twitter currently sends Opera a style sheet with empty settings for rounded corners…

…so, all I did was write a script that will insert a link to a style sheet that’s stored here at kyleabaker.com which overwrites these empty styles with the correct ones.

If you’ve never used scripts before then you should first learn how to setup UserJS. After you’ve setup Userjs, you may need to enable UserJS for secure pages (https) in Opera’s internal configuration page….”opera:config#UserPrefs|UserJavaScriptonHTTPS“. Just check/enable that option. Make sure to click save!

Lastly, save the “Twitter-Rounded” script to your UserJS folder that you setup in the steps above.

Now you have a more pleasant looking Twitter page in Opera 10.5. ;)

WP-UserAgent and WP-TwitterBadge

I’ve just pushed a few updates to my WP-UserAgent and WP-TwitterBadge plugins. If you’re already using them then you should be able to update via your WordPress Admin area shortly.

If you’re not using them yet, feel free to browse around and check into them!

Dropbox has File Smarts

I’ve noticed after uploading several files that Dropbox is now smart and can do an md5 hash check on other files that have been uploaded to their server.

How does this help you? Well, I’ll explain soon, but if you’re downloading a file that someone else has already downloaded and synced with Dropbox then it helps you tremendously!

Basically, Dropbox checks to see if anyone has previously uploaded the exact same file in the past. If they have then you’re in luck!

If the md5 hash matches (I’m purely guessing that they use md5 since it’s the commonly accepted standard for file checking) then they simply “copy n’ paste” what someone else has already uploaded into your personal upload space!

This means that the 347mb file that you want to sync could take 10 seconds to be synced with your account even over a dial-up connection if someone else has already taken the time to upload it for the first time!

If you’re the first person to upload your file then you will certainly have to wait the due time for a proper upload, so don’t expect it with every file.

This is an ingenious move by the Dropbox team as it saves them tons of much needed bandwidth performance and instead pushes the workload to the server side “copy n’ paste” routine…which will perform much faster than your dial-up or simple broadband connection.

Imagine the speed of uploading a 10mb file to Dropbox verses copying that same file from one folder on your hard drive to another folder on your hard drive. That is similar to the performance that you can expect.

It also obviously saves you time since you can sometimes drag n’ drop a large file…blink…then it’s done.

Don’t worry, your files are safe. Chances are slim that someone will upload a file that matches yours in filename and md5 hash code, …but it could happen.

It’s been proven that the md5 hash is insecure, but the chances of someone uploading a file that is recognized as one of yours is very very…(repeat as needed)…very slim.

Honestly, the biggest thing to worry about is the fact that if you delete a private file, someone else could happen to upload a file matching the filename and md5 hash and automatically have access to a file that you uploaded ages ago.

I’m current unaware of how long Dropbox caches the files that you store using their service, but I know that some files that I’ve uploaded in the past and deleted now have been removed from the server…so security is fairly assuring.

While it’s a little creepy and it sounds dangerous….it’s highly improbable.

On the Dropbox teams side, saving bandwidth means that you have that much extra bandwidth to upload content that you need sync’d. Bandwidth is very important these days especially considering that many of us are uploading videos (whether they be family or leisure) and music. Many of these files can range from 3mb for music up to 10gb for video (and blu-ray will bring even higher filesizes :P ).

Of the sync services that I’ve used (and it’s been a lot so far), Dropbox is by far the front runner. With the features that they offer that you’re not normally aware of, they already pass up the competition hands down. That’s just my own personal opinion.

I’m currently on the free service (2gb), but I would highly suggest that you purchase their pay-for service that gives you up to 50gb of online storage if you’re one to upload a lot or need a lot on the go.

At the very least give them a try and download the Dropbox application. I’m sure anyone could take advantage of the free 2gb package that they offer online to backup important documents or whatever it may be. ;)

Rest assured that if you’re using Dropbox then you’re also using one of the best available sync services to be established thus far! Free space never hurt anyone. ;)

Merry Christmas to all… and to all a good night.

Travel safe and have a very Merry Christmas! I know I will, since we still have plenty of snow to make for a white Christmas!

Opera 10.5 Pre-Alpha Internal Release

I’ve just given a leaked release of Opera 10.5 Pre-Alpha a test drive and I must say that I’m very impressed with the changes I’ve noticed thus far!

I look forward to testing the Official Opera 10.5 Pre-Alpha release on Tuesday, December 22. However, until then I’ll be digging through this leaked version.

Note that Opera has officially warned against installing such leaked builds, stating that the official release will be “much better and you don’t risk getting nasty trojans on you pc.” ;)

Here are some screenshots I’ve taken. I don’t cover everything, but just enough to give you a good idea of what we should be expecting. I also won’t be detailing all of these pictures, but a picture is worth a thousand words right? Inspect them and see what you can find!

I did notice a lot of skin changes and a couple of bugs here and there dealing with the skin, but it’s overall very much improved. The internal “opera:*” pages also seem to be using a different style than previous builds, but then again they may have dropped using the Opera logo in the top of the pages.

Notice the border-radius support!

Try this build at your own risk!
http://rapidshare.com/files/323481638/Opera_1050_20192_in.msi
http://depositfiles.com/files/e01z2q5qp

Opera Google Wave Skin

I’ve been using a new theme lately for Ubuntu that is based on the appearance of Google Wave. One thing that I hate about Opera in Linux is that it doesn’t automatically inherit the current themes appearance. The only way to make Opera match your current theme is to download a skin for that theme or to make one yourself.

I’ve decided to modify the standard skin by updating the background behind the tabs and changing the scrollbar images to match the rest of my current themes scrollbars.

There are still several more tweaks to make, but for now I’m very satisfied with the integrating feel that these small changes have made.

opera-google-wave-skin

I may upload this Opera skin later, but not while I’m still tweaking it. In the meantime, if you want this skin then just contact me and I’ll send you what I’ve made so far.

Last exam of the semester

So I got up earlier than I expected to this morning, which leaves me with plenty of extra time to prepare for my last exam (that isn’t until 6pm).

Hopefully I can start finding some time to get some Christmas shopping out of the way, or at least make a shopping list to make things go fast! It seems like I’m late to get any shopping accomplished every single year, but then again…I’m broke every single year as well. :P

Back to the books after a quick break catching up on the news and social sites..

Sitting on a couch..then crash

So, tonight I’m sitting on a couch at my friend’s apartment. We’re just skipping channels watching nothing at all (mostly just talking).

Imagine a crash through your kitchen. Well, that’s basically what happened.

A drunk driver ran a stop sign and ran straight into my friends apartment pushing the entire kitchen counter and dishes into the wall and floor.

I jumped up and first thing said, “Dude, someone just ran into your house,” which we later found out to be very true. So a drunk driver hit my friends house and I jumped up thinking it was going to hit me after it shook me nearly off the couch.

I ran to the back door, opened it and saw two headlights approximately 10 feet away. That alone was a sign that I shouldn’t attempt to assist the situation (yet).

As it turns out, the person that hit the house was an acquaintance and someone that I had recently met. While he is a great person and very friendly, he did a very stupid thing.

As I opened the door I see two headlights backing out and the vehicle hits a power source, …then the road. They take off speeding.

The damage done was, a kitchen sink, counter, garbage disposal, cabinets, glasses, dishes, etc… spread all over the floor.

Honestly, if anyone were in the kitchen at the time then they would have been in pain and probably more. Luckily, no one was hurt and everyone was alert.

We were all shook up and nervous, so when the police came and questioned us we all gave detailed descriptions.

Fortunately we all knew who the drunk was and we all wanted to prosecuted him for his stupidity and endangerment.

The current status is that he is still at large although his vehicle is still at his home and officers are waiting outside his home.

The police are at this minute waiting outside his home waiting for him to come out.

Without a sign of him being home they are not allowed to enter, but they are scoping the property for signs of someone there.

The deck was destroyed… railing was crushed, couch was crushed, foldout chairs were crushed….everything gone.

When the car hit, I was sitting on the sofa. The impact pushed me nearly off the couch.  That’s when I knew something went terribly wrong.

The police have taken my information for now, but we’ll find out if I’m actually needed (I hope not). Here’s to staying sober and driving under the “uninfluence”.

Most people say drunk accidents will never happen to them (that’s me), but this honestly come out of nowhere. Be safe, drive sober or don’t drive at all. ;)

Now I have to open my schedule due to a stupid drunk driver. Let’s hope they catch him before they need me for jury duty!

Google Wave + Maintenance = ..Day at the Beach?

So I recently noticed a small box at the top of my Google Wave account that mentioned something about being “offline”. I knew this wasn’t true, so I clicked the simple “Connect now” link in the same box.

With no success, I decided it would be easier to just close the tab and go to the address again (as this fixes Gmail sometimes).

Here is what I was presented:
gwave-maintenance

At least their maintenance page has some moving clouds and rolling waters…unlike Twitters. :P

If you’re looking for a Google Wave invite, I’ve still got some left!



 

March 2010
S M T W T F S
« Feb    
 123456
78910111213
14151617181920
21222324252627
28293031  
The W3C validators rely on community support for hosting and development.
Donate and help us build better tools for a better web.