The title might not be clear, so let me quickly explain again.
What I need:
#1. An [upload image from local files] button
#2. When users copy a paragraph from another site (with text + images) and paste that into my wpForo forum, they should see the images are pasted correctly as well. By "correctly" I mean the user should be able to see the images while editing their post and move the images around, and of couse those images should display correctly after the post is posted.
After some quick search, it seems like #1 can be solved easily using the Advanced Attatchment or wpDiscuz plugin (I haven't tried either of those though). But is there a solution or workaround for #2? The closest I know is the Advanced Attatchment plugin as it allows users to insert the image correctly if the clipboard contains a single image only. But it won't work if I copy a paragraph [text + image + text]; the image for some reason is lost.
I can help you with #1. Using the following script (posted somewhere in the forum by the admins) will auto make your image attachments appear in the body (embed). This snipet should be in your functions of your theme or use some snipet plugin for Wordpress.
add_filter('wpforo_content_after', function( $content ){ return preg_replace_callback( '#<a[^><]*\sclass=[\'\"](?\s[^\'\"]*)?[\'\"][^><]*\shref=[\'\"]([^\"\']+)[\'\"][^><]*>.*?</a>#isu', function( $match ){ $html = $match[0]; $file = $match[1]; $pathinfo = pathinfo( $file ); if( wpforo_is_image($pathinfo['extension']) ) { $html = sprintf( '<a href="%1$s" target="_blank"><img class="wpforo-default-image-attachment" src="%1$s" alt="%2$s" title="%2$s"></a>', esc_url($file), esc_attr($pathinfo['basename']) ); } return $html; }, $content ); }, 11);
Hi @crescendo,
I have Created a Test topic in your website and added a post with text image text: https://forum.crescb.com/ize-composition/test-topic-by-wpforo-support-team/
How you see, there are no issues in the First Post, however in the second Post you can see the same image 3 times with different sizes.
The First post content and second post content are copied from different websites, and the reason why the second post shows the same image 3 time with different sizes is the image HTML.
We cannot do anything in this case, this is not related to wpForo it's related to HTML used for that Image.
Working HTML: https://cupofjo.com/2022/01/an-a-frame-cabin-in-minnesota-with-gorgeous-lake-views/
Not Working HTML: https://garconjon.com/mr-marcus-leatherdale-artist/
After some testing on other forum sites (non-wordpress ones), I noticed when I copy an image from outside that site, the image is automatically uploaded to the site's server and is displayed with that image source. Correct me if I'm wrong, but is this the reason why copying & pasting may not work for a wpForo forum?
I Don't Follow you.