Welcome, Guest. Please login or register.
Friday, July 30, 2010 (15:51)
Home Help Search Login Register
News: mwCMS now uses Mantis (on SourceForge.net) as bugtracker.

+  mwCMS
|-+  English support
| |-+  Bugs, problems and questions
| | |-+  Multiple pictures in one page
« previous next »
Pages: [1] Print
Author Topic: Multiple pictures in one page  (Read 1120 times)
Buggy
Newbie
*
Posts: 7

View Profile
« on: Monday, September 29, 2008 (16:51) »

Hello!

i'm having difficulties to use thumbs with mwcms. mediawiki is just fine, but mwcms doesn't create the links properly.

cu buggy
Logged
ClausVB
Administrator
mwCMS supporter
*****
Posts: 73


View Profile
« Reply #1 on: Tuesday, September 30, 2008 (16:00) »

This is a bug. Fixed in the next release.

You can change your "include/class_parser.php":

Code: [Select]
<?php
(...)

// Images
if (preg_match(
    
'!src="(.*?)/thumb(.*?)/([0-9]{2}|[0-9]{3})px(.*?)"!',
    
$oneLine,
    
$src)
  or 
preg_match('/class="image"/'$oneLine)
)
{
  if (
count($src) > 1// Is this image a thumbnail?
  
{
    
// Find all thumbnails in this line
    
$count_thumbnails substr_count($oneLine'<a href');

    if (
$count_thumbnails 1// More than one thumbnail in this line?
    
{
      
$exploded_line explode('<a href'$oneLine);

      foreach (
$exploded_line as $string)
      {
        
preg_match(
          
'!src="(.*?)/thumb(.*?)/([0-9]{2}|[0-9]{3})px(.*?)"!',
          
$string,
          
$thumbSource
        
);

        if (
preg_match('!^="/index.php/Bild:!'$string))
        {
          
// original: ="/index.php/Bild: ...
          // replaced by: <a href="http://your.domain.net/images/c/c2/pic1.jpg ...
          
$newString .= '<a href' preg_replace(
            
'!/index.php/Bild:[\w-_]+\.([a-z]{3}|[a-z]{4})!',
            
'http://' SERVER $thumbSource[1] . $thumbSource[2],
            
$string
          
);
        }
        else
        {
          
$newString .= $string;
        }
      }

      
$modifiedLine $newString;
    }
    else 
// Just one thumbnail in this line
    
{
      
$modifiedLine str_replace('<img''<a href="http://' SERVER $src[1] . $src[2] . '"><img'$modifiedLine);
    }
  }
  else
  {
    
// Delete hyperlink to image (it's not a thumbnail), but store TITLE attribute
    
$modifiedLine preg_replace(
      
'!<a href="(.+)" class="image" title="(.+)"><img !',
      
'<!-- mwCMS: Delete hyperlink to image (no thumbnail) --><img title="$2" ',
      
$modifiedLine
    
);

    
$modifiedLine str_replace('/></a>''/>'$modifiedLine);
  }

  
// MediaWiki in a subdomain, e.g. "http://mediawiki.your-domain.tld"
  
$modifiedLine str_replace('src="''src="http://' SERVER$modifiedLine);

  
/**
   * MediaWiki in a subdirectory, e.g. "http://localhost/mediawiki", then
   * delete the line above or use "//".
  **/
}

(...)
?>

WATCH OUT: This code is within the method called "ParsingEveryLine".

Thanks for reporting this bug.

Regards,
Claus
Logged
Pages: [1] Print 
« previous next »
 


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC Valid XHTML 1.0! Valid CSS!