WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: HTML Import 2] importing images to media – fix – WP 3.4.1

[Resolved] [Plugin: HTML Import 2] importing images to media – fix – WP 3.4.1

  • After I made the below changes importing images worked right. Before it imported images but file type was blank when viewed from media page, and so thumbnails were not being generated and img tags were not displaying properly. I’m not sure if this is right way to do it, but it worked. Hope this helps someone.

    WordPress 3.4.1
    HTML Import 2.2

    Line 553:

    Change

    $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );

    to

    $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => wp_check_filetype( $file, null ) ) );

    Line 579

    Change

    $attachment = array(
    	'post_mime_type' => $type,

    to

    $attachment = array(
    	'post_mime_type' => wp_check_filetype( $file, null ),

    http://wordpress.org/extend/plugins/import-html-pages/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Stephanie Leary

    @sillybean

    Thanks, I’ll get that fixed for the next release!

    mchev2s solution is almost perfect, but wp_check_filetype returns an array and not a single string.

    May be this will be better.

    $wp_filetype = wp_check_filetype(basename($filename), null );
    $attachment = array(
    	'post_mime_type' => $wp_filetype['type'],

    Plugin Author Stephanie Leary

    @sillybean

    Thank you both! These fixes are in 2.3, available now.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] [Plugin: HTML Import 2] importing images to media – fix – WP 3.4.1’ is closed to new replies.