Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding an image to a topic?

  • 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.

Viewing 4 replies - 1 through 4 (of 4 total)

  • chrishajer
    Participant

    @chrishajer

    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.

    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?


    _ck_
    Participant

    @_ck_

    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.

    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

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.