11
madDan
Re: xoops.js missing?
  • 2010/6/11 3:00

  • madDan

  • Not too shy to talk

  • Posts: 105

  • Since: 2010/1/6 1


I have followed your advice above in #8

Is the fix you state when actually including it in viewtopic and viewpost any thing to do with refresh?

As I am finding images don't appear to scale unless I do a refresh after opening that post.

An example is

http://www.theroadster.net/trc/modules/articles/

When I view it (currently at work on IE7) the articles list opens with images at their full scale then scale down after doing a refresh, but if I navigate away and come back I have to refresh again, now for the index I can obviously make thumbnails but the main images within the articles and forum posts act the same..

Is this more likely to be a browser issue than the site software?

12
ghia
Re: xoops.js missing?
  • 2010/6/11 3:50

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Don't understand exactly your clarification but it seems normal to me as in eg the forum at /modules/newbb/viewtopic.php?post_id=165831#forumpost165831

Do you see any differences with some articles here?

13
madDan
Re: xoops.js missing?
  • 2010/6/11 5:10

  • madDan

  • Not too shy to talk

  • Posts: 105

  • Since: 2010/1/6 1


I can't see the images as they are blocked at work

I'll test later at home.

14
kris_fr
Re: xoops.js missing?
  • 2010/6/11 10:06

  • kris_fr

  • Theme Designer

  • Posts: 1009

  • Since: 2005/12/31


Hi,

When you write an article, the link images are badly written, look at your sample code cource below:

<a href='javascript:CaricaFoto("/articleimg/CoupeRear/RemovingtheCouperear010.jpg");'><img src='/articleimg/CoupeRear/RemovingtheCouperear010.jpg' alt='Open in new window' border='0' onload="javascript:imageResize(this, 300)"/></a>



/articleimg/.... but normally /article/img/...

no ?


@++

15
ghia
Re: xoops.js missing?
  • 2010/6/11 10:27

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


No, the link is OK, else the image would not show at all.

Only problem left is that the image is clickable, but nothing happens when you do.
This is because /class/textsanitizer/image/image.js is missing in the header.
What is in your /class/textsanitizer/image/config.php and did you make changes to it?

16
madDan
Re: xoops.js missing?
  • 2010/6/11 11:55

  • madDan

  • Not too shy to talk

  • Posts: 105

  • Since: 2010/1/6 1



Re the address it is absolutely fine, that is simply the address I use, itis nothing to do with the articles module, it is where I manually upload images to.

17
madDan
Re: xoops.js missing?
  • 2010/6/11 12:11

  • madDan

  • Not too shy to talk

  • Posts: 105

  • Since: 2010/1/6 1


Quote:

ghia wrote:
No, the link is OK, else the image would not show at all.

Only problem left is that the image is clickable, but nothing happens when you do.
This is because /class/textsanitizer/image/image.js is missing in the header.
What is in your /class/textsanitizer/image/config.php and did you make changes to it?



here is my /class/textsanitizer/image/config.php

<?php
/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
 * TextSanitizer extension
 *
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         class
 * @subpackage      textsanitizer
 * @since           2.3.0
 * @author          Taiwen Jiang <phppp@users.sourceforge.net>
 * @version         $Id: config.php 3575 2009-09-05 19:35:11Z trabis $
 */
defined('XOOPS_ROOT_PATH') or die('Restricted access');

return 
$config = array(
    
// Click to open an image in a new window
    
'clickable' => 1,
    
// Resize the iamge
    
'resize' => 1,
    
// Maximum width of an image displayed on page, otherwise it will be resized
    
'max_width' => 300);

?>


class/textsanitizer/image/image.js is present and unaltered by me.

php
/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
 * TextSanitizer extension
 *
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         class
 * @subpackage      textsanitizer
 * @since           2.3.0
 * @author          Taiwen Jiang <phppp@users.sourceforge.net>
 * @version         $Id: image.php 3575 2009-09-05 19:35:11Z trabis $
 */
defined('XOOPS_ROOT_PATH') or die('Restricted access');

class 
MytsImage extends MyTextSanitizerExtension
{
    function 
load(&$ts)
    {
        static 
$jsLoaded;

        
$config $this->loadConfig(dirname(__FILE__));
        
$ts->patterns[] = "/[img align=(['"]?)(left|center|right)\1 width=(['"]?)([0-9]*)\3]([^"()?&'<>]*)[/img]/sU";
        
$ts->patterns[] = "/[img align=(['"]?)(left|center|right)\1]([^"()?&'<>]*)[/img]/sU";
        
$ts->patterns[] = "/[img width=(['"]?)([0-9]*)\1]([^"()?&'<>]*)[/img]/sU";
        
$ts->patterns[] = "/[img]([^"()?&'<>]*)[/img]/sU";
        
// Added for script driven images
        
$ts->patterns[] = "/[img align=(left|right|center) width=([0-9]*)](.*)[/img]/sU";
        
$ts->patterns[] = "/[img width=([0-9]*) align=(left|right|center)](.*)[/img]/sU";
        
$ts->patterns[] = "/[img align=(left|right|center)](.*)[/img]/sU";
        
$ts->patterns[] = "/[img width=([0-9]*)](.*)[/img]/sU";
        
$ts->patterns[] = "/[img](.*)[/img]/sU";

        
$ts->patterns[] = "/[img align=(['"]?)(left|center|right)\1 id=(['"]?)([0-9]*)\3]([^"()?&'<>]*)[/img]/sU";
        
$ts->patterns[] = "/[img id=(['"]?)([0-9]*)\1]([^"()?&'<>]*)[/img]/sU";

        if (empty(
$ts->config['allowimage'])) {
            
$ts->replacements[] = '<a href="\5" rel="external">\5</a>';
            
$ts->replacements[] = '<a href="\3" rel="external">\3</a>';
            
$ts->replacements[] = '<a href="\3" rel="external">\3</a>';
            
$ts->replacements[] = '<a href="\1" rel="external">\1</a>';
            // Added for script driven images
            
$ts->replacements[] = '<img align="\1" width="\2" src="\3">';
            
$ts->replacements[] = '<img align="\2" width="\1" src="\3">';
            
$ts->replacements[] = '<img align="\1" src="\2">';
            
$ts->replacements[] = '<img width="\1" src="\2">';
            
$ts->replacements[] = '<img src="\1">';

            
$ts->replacements[] = '<a href="' . XOOPS_URL . '/image.php?id=\4" rel="external" title="\5">\5</a>';
            
$ts->replacements[] = '<a href="' . XOOPS_URL . '/image.php?id=\2" rel="external" title="\3">\3</a>';

        } else {
            if (!empty(
$config['clickable']) && !empty($config['max_width']) && !empty($GLOBALS['xoTheme'])) {
                if (!
$jsLoaded) {
                    
$jsLoaded = true;
                    
$GLOBALS['xoTheme']->addScript('/class/textsanitizer/image/image.js', array(
                        'type' => 'text/javascript'));
                }
                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\5");'><img src='\5' class='\2' alt='Open in new window' border='0' onload="JavaScript:if(this.width>\4)this.width=\4" /></a>";
                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\3");'><img src='\3' class='\2' alt='Open in new window' border='0' " . ($config['resize'] ? "onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";
                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\3");'><img src='\3' alt='Open in new window' border='0' onload="JavaScript:if(this.width>\2)this.width=\2" /></a><br />";
                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\1");'><img src='\1' alt='Open in new window' border='0'" . ($config['resize'] ? " onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";

                // Added for script driven images
                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\3");'><img align='\1' width='\2' src='\3' alt='Open in new window' border='0'" . ($config['resize'] ? " onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";

                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\3");'><img align='\2' width='\1' src='\3' alt='Open in new window' border='0'" . ($config['resize'] ? " onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";
                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\2");'><img align='\1' src='\2' alt='Open in new window' border='0'" . ($config['resize'] ? " onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";
                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\2");'><img width='\1' src='\2' alt='Open in new window' border='0'" . ($config['resize'] ? " onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";
                
$ts->replacements[] = "<a href='javascript:CaricaFoto("\1");'><img src='\1' alt='Open in new window' border='0'" . ($config['resize'] ? " onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";

            } else {
                
$ts->replacements[] = "<img src='\5' class='\2' border='0' alt='' onload="JavaScript:if(this.width>\4) this.width=\4" />";
                
$ts->replacements[] = "<img src='\3' class='\2' border='0' alt='' " . ($config['resize'] ? "onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";
                
$ts->replacements[] = "<img src='\3' border='0' alt='' onload="JavaScript:if(this.width>\2) this.width=\2" />";
                
$ts->replacements[] = "<img src='\1' border='0' alt='' " . ($config['resize'] ? " onload="javascript:imageResize(this, " $config['max_width'] . ")"" : "") . "/></a>";
                // Added for script driven images
                
$ts->replacements[] = '<img align="\1" width="\2" src="\3">';
                
$ts->replacements[] = '<img align="\2" width="\1" src="\3">';
                
$ts->replacements[] = '<img align="\1" src="\2">';
                
$ts->replacements[] = '<img width="\1" src="\2">';
                
$ts->replacements[] = '<img src="\1">';

            }
            
$ts->replacements[] = '<img src="' . XOOPS_URL . '/image.php?id=\4" class="\2" alt="\5" />';
            
$ts->replacements[] = '<img src="' . XOOPS_URL . '/image.php?id=\2" alt="\3" />';
        }
        return true;
    }
}

?>

I have not touched these files myself at all.



Had a nap, now back at home, the site works as advertised ie the images scale on the post or articles list first displaying without having to refresh.

On both Firefox 3.6.3 and IE 8.0.76, so the issue with scaling and refreshing must either be a browser related or browser settings or company security restrictions related issue.


I am sorry for wasting your time with this.

I have been trying to resolve various things, mybe I should stick to doing fault finding at home before confusing the issue?

So it looks as if the problem I posted last night is definately work related as is the debug window being blank, it works fine here at home with image.js in the standard place.

I can only appologise once more.

18
madDan
Re: xoops.js missing?
  • 2010/6/11 13:47

  • madDan

  • Not too shy to talk

  • Posts: 105

  • Since: 2010/1/6 1


now I am confused

Why do unsized article images ie those without the
[img width=300]xxxxx[/img]
work and resize when logged in but not when logged out

have a look at

http://www.theroadster.net/trc/modules/articles/article.php?id=112


When logged in they scale automatically even with just
[img]xxxxxxxx[/img]



if you look at

http://www.theroadster.net/trc/modules/articles/article.php?id=129 this article uses the [img width=xxx]


if you take a look at www.theroadster.net/maddan/scaleissue.jpg


it will show what I am seeing as a logged in and none logged in person with regard to none scale specified image tags ie the width part.

If an article has the image tag with width it is fine, any idea why is auto scales logged in and not so when logged out?


Thought I was going mad for a while there


Obviously I can go through the articles and search and replace unspecified [img] tags to [img width=300] or whatever.

19
ghia
Re: xoops.js missing?
  • 2010/6/11 14:38

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


As I said, this is because /class/textsanitizer/image/image.js is missing in the header. Probably it is present when you are logged in.
The image scaling system varies with the img tag.
If you specify [img width=, then the width is enforced by
onload="JavaScript:if(this.width>300)this.width=300"

If you specify a plain [img] tag, then the max_width of the configuration file is enforced:
onload="javascript:imageResize(this, 300)"

The first resizing uses plain JavaScript and works always, but the second calls the imageResize() function and that must have image.js loaded. If that one is not there as I see when unlogged, then nothing happens, but in your browsers error console you will find some messages as Quote:
Error: imageResize is not defined
and Quote:
Error: CaricaFoto is not defined

Due to the missing script, the popup with the real size image is not shown when clicking the resized image.

The loading for the script is done by:
if (!empty($config['clickable']) && !empty($config['max_width']) && !empty($GLOBALS['xoTheme'])) {
                if (!
$jsLoaded) {
                    
$jsLoaded true;
                    
$GLOBALS['xoTheme']->addScript('/class/textsanitizer/image/image.js', array(
                        
'type' => 'text/javascript'));
                }

I suspect something wrong with the xoTheme, while the other variables are in place, but I have no further clues.

Quick and dirty repair could be to insert the image.js in the header of your theme.html

20
madDan
Re: xoops.js missing?
  • 2010/6/11 15:47

  • madDan

  • Not too shy to talk

  • Posts: 105

  • Since: 2010/1/6 1


Cheers for the pointers, I'll have to have a dig about

Login

Who's Online

164 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 164


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits