WordPress.org

Ready to get started?Download WordPress

Forums

HTML Import 2
[resolved] importing images to media - fix - WP 3.4.1 (4 posts)

  1. Mohan Chevuri
    Member
    Posted 2 years ago #

    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/

  2. Stephanie Leary
    Member
    Plugin Author

    Posted 2 years ago #

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

  3. Carsten Bach
    Member
    Posted 1 year ago #

    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'],
  4. Stephanie Leary
    Member
    Plugin Author

    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic