bbPress

Simple, fast, elegant

bbPress Plugin Browser »

Allow Images (0.9)

Download

Version: 0.9

Other Versions

Last Updated: 2009-10-24

Requires bbPress Version: 0.8.4 or higher

Compatible up to: 1.0.2

Author Homepage »

Plugin Homepage »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(44)

Your Rating

Authors mdawaffe, qayqay12

Tags: ,

  1. Is this pluggin compatable with 1.0 alpha?

    I uploaded allow-images.php to my /bb-plugins/ directory and activated it.

    I attemped producing images on a test account with the tags:

    <img src="http://www.l4dt.com/L4DTbanner.png" />

    and <img src="http://www.l4dt.com/L4DTbanner.png" >

    and <img src="http://www.l4dt.com/L4DTbanner.png"> </img>

    Non of them successful.

    The site referenced is at http://www.l4dt.com/forum

    Are there any possible image post alternatives?

    Thank you for your time and consideration,
    Mikeumus

    Posted: 1 year ago #
  2. It would be good to add a maximum width and height for this tag images to resize big images to suitable view with hyperlink to view full image. I'm saying not about php works on creating thumbnails and storeing them on server, but html sizes for the images.

    Can someone help me, what to change in code to realize that?

    Posted: 1 year ago #
  3. wilcosky

    Member

    Hey vertus,

    Like pjrobertson said a page or so back, all you have to do to limit the image size is add this to style.css in your template folder:

    .threadpost img
    {
    width:98%;
    }

    I made the width 98% instead of 100%, because with 100% the image goes all the way to the edge, so to make it look better, I chose 98%. Just change the width to whatever you think looks best.

    Posted: 1 year ago #
  4. wilcosky

    Member

    Update to post above... I wouldn't recommend adding that to your css if you use an emoticon package. Why? Because that css code will make sure that all images are 98% including little emoticons. So, your emoticons will be HUGE.

    This seems to work better. I don't know how it works in all browsers but it's the easiest solution I can find:

    .threadpost img{
    max-width:98%;
    max-height:800px;
    }

    You can of course change those values to whatever you want. Why did I use % and px? Cause I'm crazy like that!

    Posted: 1 year ago #
  5. vari

    Member

    To mikeumus, I have it working with 1.0 Alpha, to use you example it works if you don't put in the quotes and a double space before the / like so -

    <img src=http://www.l4dt.com/L4DTbanner.png />

    the system will add in the "" marks itself around the URL. Very strange.

    Posted: 1 year ago #
  6. vari

    Member

    In ref to above, every time you edit your profile it adds another set of quotation marks around the image url and actually removes a letter at a time and breaks the url...

    Posted: 1 year ago #
  7. Just tested on 1.0-a6 (trunkish from last month) and I have no issues with the plugin.

    Posted: 1 year ago #
  8. Installed... enabled... it created the IMG button in the create post form... I inserted a image url... it inserted it into the body with [img] and [/img] tags surrounding it... click post... no image shows up, just the url with the [img] tags around it. After a bunch of time messing with it ended up just writing my own filter function.

    Posted: 11 months ago #
  9. @valiik it does not allow bbcode, it uses html so <img src="url" /> if you want bbcode search the forums for bbcode lite

    Posted: 11 months ago #
  10. Dawormie

    Member

    Possible to build a auto-riser into this?

    Allow images to be no larger than a certain width? And if they exceed that width, then it's resized via js?

    There was something like this for a phpBB mod. Also truncated long lines of text and auto-wrapped them.

    Posted: 10 months ago #
  11. If the plugin is enabled I can't use the backticks anymore to post code.
    Any idea ?
    I'm using bbPress 1.0 rc1.

    How to reproduce it:
    1. enable the plugin
    2. post code using backticks

    If the plugin is disabled, code can be posted without problemss

    Posted: 9 months ago #
  12. I'm guessing the same bug that caused anchor tags to get cut off is causing compatibility issues with Allow Images used with RC2. Does anyone know what was changed in RC2 recently to fix the problem with anchor tags?

    Posted: 9 months ago #
  13. To get the image plugin working, comment out:

    remove_filter( 'pre_post', 'encode_bad' );
    add_filter( 'pre_post', 'allow_images_encode_bad', 9 );
    Posted: 9 months ago #
  14. thanks, timskii

    Posted: 9 months ago #
  15. Worked perfectly for me! :D

    Using new bbPress 1.0 (stable, not sure what 'version' it's called) that was released on July 3rd ;)

    Posted: 8 months ago #
  16. _ck_

    Moderator

    Note that using timskii's modification disables the entire point of the plugin's security feature.

    Posted: 8 months ago #
  17. thekmen

    Member

    Has anyone got this working with bbPress 1.0 without disabling the security?
    Surely it can't be this hard to add an image to a topic?

    Posted: 8 months ago #
  18. Anyone have a way to get this working without removing security?

    Posted: 8 months ago #
  19. nikloveland

    Member

    Works for me if I leave off the quotes around the src attribute:
    <img src=image.jpg />

    But when I go to edit the post it will put the quotes around the source and if I don't take them off, the image will disappear.

    Posted: 8 months ago #
  20. Just replace full code with this:

    <?php
    /*
    Plugin Name: Allow Images
    Plugin URI: http://bbpress.org/#
    Description: Allows <img /> tags to be posted in your forums.  The image must be a png, gif or jpeg.
    Author: Michael D Adams
    Author URI: http://blogwaffe.com/
    Version: 0.7.1
    */
    
    // You can add more tags here
    function allow_images_allowed_tags( $tags ) {
     	$tags['img'] = array('src' => array(), 'title' => array(), 'alt' => array());
    	return $tags;
    }
    
    function allow_images( $text ) {
    	if ( preg_match_all('/<img(.+?)src=("|\')(.+?)\\2(.*?)>/i', $text, $matches, PREG_SET_ORDER ) ){
    		foreach( $matches as $match ){
    			if (preg_match('/src=/i', $match[4]) /* multiple src = someone's trying to cheat */ || !in_array(substr($match[3], -4), array('.png', '.jpg', '.gif'))  /*only match .jpg, .gif, .png*/	&& '.jpeg' != substr($match[3], -5) /*and .jpeg*/){
    				$text = str_replace($match[0], '', $text);
    			}
    		}
    	}
    	return $text;
    }
    
    	add_filter( 'pre_post', 'allow_images', 52 );
     	add_filter( 'bb_allowed_tags', 'allow_images_allowed_tags' );
    
    ?>

    I think, it wont raise any security issues.
    Got it from here: http://plugins-dev.bbpress.org/browser/allow-images/trunk/allow-images.php

    Posted: 8 months ago #

RSS feed for this topic

Add a Comment »

You must log in to post.

Code is Poetry.