Warning: The author of this contribution does not provide support for it anymore.

Live Preview

Support with ReImg Image Resizer - Live Preview

Support with ReImg Image Resizer

by digitaldiy » Tue Feb 08, 2011 8:36 am

Is it possible to extend support for the ReImg mod?

Currently the LivePreview mod reloads the image resulting in a flashing image every couple of seconds which affects page height and those susceptible to epilepsy.
digitaldiy
Registered User
Posts: 28
Joined: Sat Jan 16, 2010 2:02 am
Contact:

Re: Support with ReImg Image Resizer

by 4_seven » Wed Feb 09, 2011 5:44 pm

For that i need a testuser on your board, bcs. i can not recognize, what kind of behavior that is.
Use ReImg the normal [img] Tag or another?
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am
Contact:

Re: Support with ReImg Image Resizer

by digitaldiy » Sat Feb 12, 2011 1:56 pm

Hi 4_seven,

I've created a temporary forum here http://sandbox.digital-diy.com/tmp_forum/

Username: test
Password: 123456

Its a fresh phpbb3 install with Live Preview and ReImg mods (only).

Please create a topic with the following content and see what happens:

Code: Select all

[img]http://sunsite.unc.edu/wm/paint/auth/durer/large-turf.jpg[/img]
digitaldiy
Registered User
Posts: 28
Joined: Sat Jan 16, 2010 2:02 am
Contact:

Re: Support with ReImg Image Resizer

by 4_seven » Mon Feb 14, 2011 2:10 am

try the following

open

styles/prosilver/template/bbcode.html

find

Code: Select all

<!-- BEGIN img --><img src="{URL}" alt="{L_IMAGE}" {REIMG_PROPERTIES} /><!-- END img -->


replace with

Code: Select all

<!-- IF SCRIPT_NAME == "posting" -->
<!-- BEGIN img --><img src="{URL}" alt="{L_IMAGE}" /><!-- END img -->
<!-- ELSE -->
<!-- BEGIN img --><img src="{URL}" alt="{L_IMAGE}" {REIMG_PROPERTIES} /><!-- END img -->
<!-- ENDIF -->
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am
Contact:

Re: Support with ReImg Image Resizer

by 4_seven » Wed Feb 23, 2011 1:02 am

Ok, i figure it out. The solution before don't work.

But this will work:

open

includes/bbcode.php

find

Code: Select all

if (!defined('IN_PHPBB'))
{
    exit;
}          


after add

Code: Select all

// Pagename Detect / 4seven / 2011
if (!isset($script_name)){
$script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
$script_name = (($pos strpos($script_name'?')) !== false) ? substr($script_name0$pos) : $script_name;
$script_name str_replace(array('\\''//'), '/'$script_name);
$page_name   basename($script_name);
$page_name   urlencode(htmlspecialchars($page_name));
$live_true   = ($page_name == 'livepreview.php') ? true false;}
// Pagename Detect / 4seven / 2011          


find

Code: Select all

        global $phpbb_root_path$template$user;       


replace with

Code: Select all

        global $phpbb_root_path$template$user$live_true;       


find

Code: Select all

                                '#\[img:$uid\](.*?)\[/img:$uid\]#s'        => str_replace('$2'reimg_properties(), $this->bbcode_tpl('img'$bbcode_id)),          


replace with

Code: Select all

                                '#\[img:$uid\](.*?)\[/img:$uid\]#s'        => ($live_true) ? $this->bbcode_tpl('img'$bbcode_id) : str_replace('$2'reimg_properties(), $this->bbcode_tpl('img'$bbcode_id)),          


find

Code: Select all

        if (empty($bbcode_hardtpl))
        {
            global 
$user;     


replace with

Code: Select all

        if (empty($bbcode_hardtpl))
        {
            global 
$user$live_true;     



find

Code: Select all

                                'img'        => '<img src="$1" alt="' $user->lang['IMAGE'] . '" ' reimg_properties() . '/>',          


replace with

Code: Select all

                                'img'        => ($live_true) ? '<img src="$1" alt="' $user->lang['IMAGE'] . '" />' '<img src="$1" alt="' $user->lang['IMAGE'] . '" ' reimg_properties() . '/>',          


find

Code: Select all

    function bbcode_tpl_replace($tpl_name$tpl)
    {
        global 
$user;   


replace with

Code: Select all

    function bbcode_tpl_replace($tpl_name$tpl)
    {
        global 
$user$live_true;   


find

Code: Select all

        static $replacements = array(
            
'quote_username_open'    => array('{USERNAME}'    => '$1'),
            
'color'                    => array('{COLOR}'        => '$1''{TEXT}'            => '$2'),
            
'size'                    => array('{SIZE}'        => '$1''{TEXT}'            => '$2'),
            
'img'                    => array('{URL}'        => '$1''{REIMG_PROPERTIES}' => '$2'),
            
'flash'                    => array('{WIDTH}'        => '$1''{HEIGHT}'            => '$2''{URL}'    => '$3'),
            
'url'                    => array('{URL}'        => '$1''{DESCRIPTION}'    => '$2'),
            
'email'                    => array('{EMAIL}'        => '$1''{DESCRIPTION}'    => '$2')
        ); 


replace with

Code: Select all

        if (!$live_true) {
        
        static 
$replacements = array(
            
'quote_username_open'    => array('{USERNAME}'    => '$1'),
            
'color'                    => array('{COLOR}'        => '$1''{TEXT}'            => '$2'),
            
'size'                    => array('{SIZE}'        => '$1''{TEXT}'            => '$2'),
            
'img'                    => array('{URL}'        => '$1''{REIMG_PROPERTIES}' => '$2'),
            
'flash'                    => array('{WIDTH}'        => '$1''{HEIGHT}'            => '$2''{URL}'    => '$3'),
            
'url'                    => array('{URL}'        => '$1''{DESCRIPTION}'    => '$2'),
            
'email'                    => array('{EMAIL}'        => '$1''{DESCRIPTION}'    => '$2')
        );
        
        }
        else {
        
        static 
$replacements = array(
            
'quote_username_open'    => array('{USERNAME}'    => '$1'),
            
'color'                    => array('{COLOR}'        => '$1''{TEXT}'            => '$2'),
            
'size'                    => array('{SIZE}'        => '$1''{TEXT}'            => '$2'),
            
'img'                    => array('{URL}'        => '$1'),
            
'flash'                    => array('{WIDTH}'        => '$1''{HEIGHT}'            => '$2''{URL}'    => '$3'),
            
'url'                    => array('{URL}'        => '$1''{DESCRIPTION}'    => '$2'),
            
'email'                    => array('{EMAIL}'        => '$1''{DESCRIPTION}'    => '$2')
        );
        
        } 


thats it..
Last edited by 4_seven on Sat Jul 30, 2011 4:38 pm
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am
Contact:

Re: Support with ReImg Image Resizer

by napus » Thu Jul 28, 2011 8:10 pm

Almost there:

Code: Select all

Parse error: syntax error, unexpected '(' in /var/www/clients/client1/web6/web/forum/includes/bbcode.php on line 489
User avatar
napus
Registered User
Posts: 128
Joined: Sat Apr 25, 2009 12:01 pm
Location: Poland
Contact:

Re: Support with ReImg Image Resizer

by 4_seven » Thu Jul 28, 2011 8:47 pm

hm, the code is tested. pls zip and link this bbcode.php.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am
Contact:

Re: Support with ReImg Image Resizer

by napus » Fri Jul 29, 2011 3:17 pm

User avatar
napus
Registered User
Posts: 128
Joined: Sat Apr 25, 2009 12:01 pm
Location: Poland
Contact:

Re: Support with ReImg Image Resizer

by 4_seven » Sat Jul 30, 2011 4:30 pm

some have changed in 3.0.9.

check the changed edit here: (the last find/replace is changed)
http://www.phpbb.com/customise/db/mod/l ... 71#p208871
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am
Contact: