Resolving unlink() errors with IImageBrowser
Even though WordPress comes with a rich editor right out of the box, I've long been a fan of the Mudbomb WYSI-WordPress plugin, coupled with the IImageBrowser add-on. Together, these nifty bits of code provide easy uploading and thumbnailing capabilities, and they're easy to install and use (though IImageBrowser could use some interface upgrades to improve usability.)
On one of my blogs however, I've always received an error when I try and upload an image: "not a valid image file". This is related to the following code in the IImageBrowser file (line 815):
$checkthatimage = getimagesize($img1);
if ($checkthatimage == FALSE) {
unlink($img1);
die (__("Not a valid image file."));
}
I did some searches at Google, WordPress' forums and at the plugins' authors' sites, but came up short. I was only posting a few times a year at that blog, so I started using FTP to upload any images as a stop-gap solution. Not pretty, but functional.
I ran into that same error today on another blog and decided it was time to figure it out once and for all. Again, I started by doing some searches, using the error message and plugin names as my queries, but I still couldn't find much… until I came across this. Aha! The problem is related to an incompatibility between IImageBrowser v. 1.4.1 and PHP 5. The solution? You have three options:
- Use the moded version of IImageBrowser found here.
- Upgrade IImageBrowser to the latest version, available here.
- Roll back PHP to version 4.x on your server. (Just what the PHP camp DOESN'T want you to do!)
Perform one of these steps and you'll be back enjoying image uploading and thumbnailing glory!















