panigrc panigrc
  • Not too shy to talk
  • Not too shy to talk
  • Joined: 2005/4/13 20:25
  • From Greece
  • Group: Registered Users
  • Posts: 133
  • Posted on: 2005/4/21 7:59
Images with title #1
This little hack ads title tag with the value of image's name. Also fixed the center align function.

imagemanager.php :
$lcode '[img align=left title=\''.$images[$i]->getVar('image_nicename').'\']'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';
$code '[img align=center title=\''.$images[$i]->getVar('image_nicename').'\']'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';
$rcode '[img align=right title=\''.$images[$i]->getVar('image_nicename').'\']'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';


and

module.textsanitizer.php :
I added one more pattern with the title attribute
$patterns[] = "/[img align=(['"]?)(left|center|right)\1]([^"()'<>]*)[/img]/sU";
$patterns[] = "/[img]([^"()'<>]*)[/img]/sU";
$patterns[] = "/[img align=(['"]?)(left|center|right)\1 id=(['"
]?)([0-9]*)\3]([^"()'<>]*)[/img]/sU";
$patterns[] = "/[img id=(['"]?)([0-9]*)\1]([^"()'<>]*)[/img]/sU";
[
b]$patterns[] = "/[img align=(['"]?)(left|center|right)\1 title=(['"]?)([^"()'<>]*)\3]([^"()'<>]*)[/img]/sU";[/b]

$replacements[] = '<div align="\2"><img src="\3" alt="" /></div>';
//$replacements[] = '<img src="\3" align="\2" alt="" />';
$replacements[] = '<img src="\1" alt="" />';
$replacements[] = '<div align="\2"><img src="'.XOOPS_URL.'/image.php?id=\4" alt="\4"  title="\4" /></div>';
//$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\4" align="\2" alt="\4" />';
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\2" alt="\3" title="\3" />';
[
b]$replacements[] = '<div align="\2"><img src="\5" alt="\4"  title="\4" /></div>';[/b]


I know its not very clean but it works .
It also has one bug. If the name of the image has ' or " then the imagemanager can't paste the code.
Thats all.
hervet hervet
  • Friend of XOOPS
  • Friend of XOOPS
  • Joined: 2003/11/4 8:49
  • From France
  • Group: Registered Users
  • Posts: 2267
  • Posted on: 2005/4/23 3:10
Re: Images with title #2
Hi,

May be you could post it here :
http://sourceforge.net/tracker/?func= ... roup_id=41586&atid=430842

Bye,
Hervé
How to effectively post a question in the Xoops forums? - Read here...
Design by: XOOPS UI/UX Team