Info
- 5 posts
- 3 voices
- Started 2 years ago by thekmen
- Latest reply from thekmen
- This topic is not resolved
Adding an image to a topic?
-
- Posted 2 years ago #
Hi all, using bbPress 1.0, how do I add an image to a topic?
Using <img src="path_to_image" /> just displays that code on the topic. -
- Posted 2 years ago #
I don't believe the Allow Images plugin works with 1.0 right now. Here's the plugin:
http://bbpress.org/plugins/topic/allow-images/page/4/I just read through the comments there that someone posted a fix, but it looks like it completely bypassed security.
-
- Posted 2 years ago #
Thanks Chris, couldn't get that to work.
Has anyone else any other solutions? Is it really this hard to add an image to a topic? -
- Posted 2 years ago #
MDA tried to put in code that prevented malformed image tags. Since bbPress uses raw html and not bbcode by default, it's always something to consider. However you can run a minimal plugin to allow any and all images quite easily:
add_filter( 'bb_allowed_tags', 'allow_images_allowed_tags' ); function allow_images_allowed_tags( $tags ) {$tags['img'] = array('src' => array(), 'title' => array(), 'alt' => array()); return $tags; }That's all that's needed to permit the image tag.
-
- Posted 2 years ago #
Perfect _ck_, thank you, that's all I needed.
For anyone else interested I added class to the array so I can style the images, so the function now reads:
add_filter( 'bb_allowed_tags', 'allow_images_allowed_tags' ); function allow_images_allowed_tags( $tags ) {$tags['img'] = array('src' => array(), 'title' => array(), 'alt' => array(), 'class' => array()); return $tags; }then added:
.featureimage { padding: 4px; background: #eee; border: 1px solid #ccc; max-width:560px; } .thumbnail { float: left; width: 100px; height: 100px; margin: 0 20px 10px 0; padding: 4px; background: #eee; border: 1px solid #ccc; }to my style.css
-
You must log in to post.