Jump to content

  •  

  • Tutorial info Visit support topic

    • Added on: Apr 16 2008 06:54 AM
    • Views: 2313
     


    * * * * *
    1 Ratings

    Adding [IMG] Tags Automatically

    This tutorial will add the [IMG] tags to links posted with the extension of an image such as gif,jpeg,jpg,png any other links posted will be converted to regular links.

    Posted by Vince on Apr 16 2008 06:54 AM
    Per this topic: http://www.invisionm...showtopic=26235

    This tutorial will add the [IMG] tags to links posted with the extension of an image such as gif,jpeg,jpg,png any other links posted will be converted to regular links.

    Revision: 1

    Files Affected:

    *sources/classes/bbcode/class_bbcode_core.php

    Open sources/classes/bbcode/class_bbcode_core.php

    Find:

    return ( isset($url['st']) ? $url['st'] : '' ) . "<a href=\"".$url['html']."\" target=\"_blank\">".$show."</a>" . $url['end'];

    Replace with:


    		# (V88)Conver Images Links to IMG tags
    		$ext = end(explode(".", $url['html']));
    		$_class = ( $this->parsing_signature ) ? 'linked-sig-image' : 'linked-image';
    
    		if ( preg_match("#^(gif|png|jpg|jpeg)#", $ext ) )
    		{
    			// If we add an alt tag - won't be able to delete image in RTE
    			return "<img src=\"".$url['html']."\" border=\"0\" class=\"". $_class ."\" />";
    		}
    		else
    		{
    			return ( isset($url['st']) ? $url['st'] : '' ) . "<a href=\"".$url['html']."\" target=\"_blank\">".$show."</a>" . $url['end'];
    		}


    Save and upload.

    That's all.

    Powered by Tutorials 1.4.1 © 2012, by Michael McCune