Can't figure out why wp_generate_attachment_metadata breaks

I have a chunk of code that sets up an attachment, but it seems to break when setting meta-data, and I can’t see anything wrong. Any chance someone could look at the code below and see if anything jumps out as the problem?

dg_debug_log(“Setting up attachment assignment for thumbnail.”:wink:;

// set up the attachment assignment for the thumbnail

$attachment_id = wp_insert_attachment($attachment, $new_file, $post_id);

dg_debug_log(“wp_insert_attachment completed”:wink:;

if($attachment_id != 0) {

dg_debug_log(“Inside attachment if statement”:wink:;

dg_debug_log(” new_file: ” . $new_file);

$attachment_data = wp_generate_attachment_metadata($attachment_id, $new_file);

dg_debug_log(“attachment metadata generated.”:wink:;

wp_update_attachment_metadata($attachment_id, $attachment_data);

dg_debug_log(“attachment metadata updated.”:wink:;

update_post_meta($post_id, ‘_thumbnail_id’, $attachment_id);

dg_debug_log(“post meta updated.”:wink:;


The thing is, since the log shows making it inside the if, the id should be good, and since the file name seems okay, the new_file variable should be good. So I don’t understand why the program simply stops executing at wp_generate_attachment_metadata.

Here’s the debug dump:

Setting up attachment assignment for thumbnail.

wp_insert_attachment completed

Inside attachment if statement

new_file: /var/www/zdecade/wp-content/blogs.dir/2/files/2012/01/Rainer Ebert.jpg

Ideas would be appreciated greatly.