The MU forums have moved to WordPress.org

Add Images in Plugin Issue (2 posts)

  1. grandslambert
    Member
    Posted 14 years ago #

    I am working on a plugin that adds images to the Media Library and everything is working on the standalone version. The plugin uses these three actions to create the attachment (assume that $attachment contains post_title, post_content, and post_mime_type and $dest is the full path to the file in the uploads folder):

    $attach_id = wp_insert_attachment( $attachment, $dest, false );
    $attach_data = wp_generate_attachment_metadata( $attach_id, $dest );
    wp_update_attachment_metadata( $attach_id,  $attach_data );
    return $attach_id;

    In standalone wordpress everything works just fine and dandy. In mu, the attachment is created, the images are created, I even get the attachment ID from the above code, but the Media Library shows no thumbnails, and I cannot use the image in my plugin. Is there anything extra needed in any of those three functions for MU to process these images correctly? Thanks.

  2. SteveAtty
    Member
    Posted 14 years ago #

    Are the files getting written to the right folder?

About this Topic

  • Started 14 years ago by grandslambert
  • Latest reply from SteveAtty