How to Fix Image Resizing Problem in the Arthemia WordPress Theme

I downloaded the Free Arthemia WordPress theme the other day to use with my students’ FBLA site. I really like how the theme looks like a professional newspaper like the New York Times as wells as how easy it is to add Headline and Featured stories just by assigning a category to them.

One thing I could get working was the images that show up with the Headline and Featured stories when you add the Image custom field to an article. The images would just show up as a red x. When I tried to view them in Firefox, I got the following error:

finfo_open(): Failed to load magic database at ‘/usr/share/misc/magic’.

After poking around on the Internet for a minute, I found that there are some files that PECL finfo uses to sniff out the MIME type of files. Apparently, the files are some sort of flat file database that holds, well, MIME types.  Luckily, I extrapolated a solution after seeing a workaround on a forum. If you’re using Arthemia Free Version 2 and are having the same problem getting your images to load, here’s all you must do.

Replace lines 216-220 of the /wp-content/themes/arthemia/scripts/timthumb.php with the following code:

$file_cmd = "file -ib  \"$file\"";
exec ($file_cmd, $exec_output);
$mime_type =  $exec_output[0];

That’s it! The only other thing you have to make sure to do to get your images to resize and show up properly is to put the absolute path to the images without your domain. So, in my case, I have an image whose full path is:

http://breathittfbla.com/wp-content/uploads/2009/07/foreman.jpg

To make it work, the value for the Image custom field has to be set to:

/wp-content/uploads/2009/07/foreman.jpg

After changing those lines of code and then putting the right file path in the Custom Field, Arthemia is resizing and displaying images in Headlines and Featured Stories without issue.  I hope this helps somebody!

6 Comments

asteroid

I’m having this same problem with the magic database not loading, but I’m not sure I replaced the code correctly – I’m using the timthumb.php from http://timthumb.googlecode.com/svn/trunk/timthumb.php. Could you please let me know what the original section of code was supposed to be, not just the line numbers, so that I know what exactly to replace? Thank you so much, I really really hope this would make the thumbnails work!

Trav

Hey asteroid,

Below is the function and where I changed the code. I commented out the section that is commented then added the section below it. That’s the only change I made.

function mime_type ( $file ) {

$os = strtolower(php_uname());
$mime_type = ”;

// use PECL fileinfo to determine mime type
// if( function_exists( ‘finfo_open’ ) ) {
// $finfo = finfo_open( FILEINFO_MIME );
// $mime_type = finfo_file( $finfo, $file );
// finfo_close( $finfo );
// }
// Check file type
$file_cmd = “file -ib \”$file\””;
exec ($file_cmd, $exec_output);
$mime_type = $exec_output[0];

asteroid

THANKS! It’s working perfectly now, after changing one quotation mark in the first line. I’m so, so grateful for this post.

Eric Barrett

I’ve been trying to get Arthemia to work on my website but I couldn’t get Timthumb to work. After countless hours of searching the internet, this simple solution turns out to be all I needed. Thanks!

Daniel Alves

Man you resolve my life. Thanks a lot for sharing your experience with us. Greetings from Brazil.

Jim

Hmmmm, not figuring this one out yet… Where does once change the
“the value for the Image custom field”

Leave a Reply

Your email address will not be published. Required fields are marked *