Skip to:
Content

bbPress.org

Opened 12 years ago

Last modified 11 days ago

#2313 new enhancement

Allow users to upload/insert images using TinyMCE

Reported by: tbermudas's profile tbermudas Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: General - Content Creation Keywords:
Cc: jared@…, pericam@…, robkk17@…

Description

Member can insert an image by URL like now and: uploading from their computer via uploader to insert the image in the content. Possibility to set size and align.

Change History (9)

#1 @jaredatch
12 years ago

  • Cc jared@… added
  • Keywords visual editor images removed
  • Milestone changed from Awaiting Review to Future Release
  • Summary changed from Upload and insert images from visual editor to Allow users to upload/insert images using TinyMCE
  • Version trunk deleted

I've talked to jjj about this a long time ago. I know it's something we like to do at some point, but it just isn't high priority compared to the moderation/performance features.

We also discussed how it would be an interesting challenge. The uploader would need to be locked down to only allow a small subset of file types. Additionally, it would be hard to use the WP media gallery/uploader because you do not want the user to be able to see the contents of your entire media gallery.

So we'd need to customize and lock down the WP media uploader or come up with our own, both which are no small task :)

#2 @tbermudas
12 years ago

Thanks, I don't know how it works... but there was a plugin, the U buddypress forum editor, I never used it because is not working, but maybe it is a good starting point.

#3 @jaredatch
12 years ago

For those who find this ticket, the best known third party alternative is http://wordpress.org/extend/plugins/gd-bbpress-attachments/

#4 @Stagger Lee
10 years ago

  • Cc pericam@… added

Is it not possible with this ?
Limit users to see only own uploaded files (doesnt apply to Admins):

function filter_my_attachments( $wp_query ) {
    if (is_admin() && ($wp_query->query_vars['post_type'] == 'attachment')) {
        if ( !current_user_can( 'activate_plugins' ) ) {
            global $current_user;
            $wp_query->set( 'author', $current_user->id );
        }
    }
}
add_filter('parse_query', 'filter_my_attachments' );

Then activate media button in reply form with this:

add_filter( 'bbp_after_get_the_content_parse_args', 'tp_bbpress_upload_media' );
 
function tp_bbpress_upload_media( $args ) {
$args['media_buttons'] = true;
 
return $args;
}

Seems it is all needed. Insert image inline in reply with text and visual editor. Size, styling and captions are easy to do and style.

#5 @Robkk
9 years ago

  • Cc robkk17@… added

There is a plugin that piggybacks off of BuddyPress, but it does the exact functionality of what we expect.

https://wordpress.org/plugins/bp-forum-editor/

#6 follow-ups: @jimmyupwp
2 weeks ago

The functionality you're describing can be implemented effectively. By leveraging the WordPress media uploader, users would have the option to upload images and insert them directly into their content. Here’s a summary of the proposed implementation steps:

Image Insertion from URL and Uploader: Users should be able to insert images both via URL and by uploading directly from their device using the WordPress media uploader. This dual capability offers greater flexibility for users when adding media to their posts.


Size and Alignment Options: By utilizing the WordPress editor's built-in functionalities, users can set image size and alignment easily. This can be achieved through the visual editor, enabling users to customize their content layout effectively.

Restricting Access to Uploaded Files


Your provided code snippet for limiting users to view only their uploaded files is a practical approach. The filter_my_attachments function you shared will ensure that non-admin users can only see their attachments in the media library. This enhances privacy and helps maintain a cleaner user experience.

Enabling Media Buttons in Reply Form

The second part of your implementation, which activates media buttons in the reply form, is also well outlined. The tp_bbpress_upload_media function you shared will ensure that users have the media upload option available when replying, making it easier to insert images inline with their text.
Conclusion

With the combination of these functionalities, users will be able to:

Insert images from both URLs and local uploads.
Set size and alignment for better content presentation.
Ensure privacy by restricting access to their uploaded files.

This comprehensive approach not only enhances user engagement but also keeps the interface intuitive and user-friendly.

If you have any further questions or need assistance in implementing this functionality, feel free to reach out!

Best regards,
jim

Last edited 2 weeks ago by jimmyupwp (previous) (diff)

#7 @anrmlx1
11 days ago

To enable image uploads in TinyMCE, include TinyMCE via CDN and initialize it with the following settings: set plugins to 'image code', and in the toolbar, include 'image' to allow image uploads. Use images_upload_url for the upload endpoint (e.g., /upload) and images_upload_handler to handle custom uploads. Within images_upload_handler, create a FormData object, append the image blob (blobInfo.blob()) to it, and send it to your server’s upload endpoint using fetch.

On the server side (e.g., Node.js), handle the upload by saving the file and responding with its URL in JSON format ({ location: '/uploads/filename' }). This setup allows images to be uploaded and inserted directly into TinyMCE's editor.

#8 in reply to: ↑ 6 @outloiiksmewp
11 days ago

The functionality you're describing can be implemented effectively. By leveraging the WordPress media uploader, users would have the option to upload images and insert them directly into their content. Here’s a summary of the proposed implementation steps:

Image Insertion from URL and Uploader: Users should be able to insert images both via URL and by uploading directly from their device using the WordPress media uploader. This dual capability offers greater flexibility for users when adding media to their posts.

#9 in reply to: ↑ 6 @vertosbrwp
11 days ago

La funcionalidad que estás describiendo puede implementarse de manera efectiva. Al aprovechar el cargador de medios de WordPress, los usuarios tendrían la opción de subir imágenes e insertarlas directamente en su contenido. Aquí tienes un resumen de los pasos propuestos para la implementación:

Inserción de Imágenes desde URL y Cargador de Archivos: Los usuarios deberían poder insertar imágenes tanto mediante una URL como subiéndolas directamente desde su dispositivo usando el cargador de medios de WordPress. Esta doble capacidad ofrece una mayor flexibilidad para los usuarios al agregar medios a sus publicaciones.

Note: See TracTickets for help on using tickets.