11
ghia
Re: xoopsCodeDecode
  • 2008/11/22 3:10

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Easy! from
"/<img src=\'(.*)\' \/>/sU"

12
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 3:19

  • Anonymous

  • Posts: 0

  • Since:


I tested it before but it is not working. I got this:

[img align=left]'http://localhost/xoops/uploads/img48eb34622bb86.jpg'[/img]


in the article text.

13
ghia
Re: xoopsCodeDecode
  • 2008/11/22 3:56

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Humm.
"/<img src=\\\'(.*)\\\' \/>/sU"
?

14
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 4:59

  • Anonymous

  • Posts: 0

  • Since:


not worknig and also when I try without quotation marks:

$patterns[] = "/<img src=(.*) align=(.*) />/sU";


I got this result:

<img src="http://localhost/xoops/uploads/hhh.jpg align=right" />


align become inside src value.



15
ghia
Re: xoopsCodeDecode
  • 2008/11/22 14:23

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Try
"/<img src='(.*)' \/>/sU"
to
"<a href=\"\\1\"><img src=\"\\1\" \/><\/a>"


What was the replacement for this:
$patterns[] = "/<img src=(.*) align=(.*) />/sU";

16
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 16:03

  • Anonymous

  • Posts: 0

  • Since:


The replacement for:
$patterns[] = "/<img src=(.*) align=(.*) />/sU";
is
Quote:
also when I try without quotation marks:

$patterns[] = "/<img src=(.*) align=(.*) />/sU";

I got this result:

<img src="http://localhost/xoops/uploads/hhh.jpg align=right" />

align become inside src value.


17
ghia
Re: xoopsCodeDecode
  • 2008/11/22 16:23

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You have for every $patterns[] a corresponding $replacements[].

When I ask you what the replacement was for $patterns[] = "/<img src=(.*) align=(.*) />/sU";, then I wanted to know what was on the $replacements[]= line is.

If you have a lot of patterns and replacements then it is possible that some rules may interfere with each other. Position is then crucial. Start always from 'complicated' to 'simpler'.

18
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 16:29

  • Anonymous

  • Posts: 0

  • Since:


This is my code:
$startdiv '<div style="float:'.$imgposition.'"><a href="'.XOOPS_URL.'/modules/news/article.php?storyid='.$storyid.'">'
            
$style 'style="border: '.$border.'px solid #'.$bordercolor.'"';
            
$enddiv 'alt="'.$thisstory->title.'" width="'.$imgwidth.'" '.$height.' /></a></div>';
            
// [img] tags 
             
$patterns[] = "/[img align=(['"]?)(left|center|right)\1 width=(['"]?)([0-9]*)\3]([^"()?&'<>]*)[/img]/sU";
            
$patterns[] = "/[img align=(['"]?)(left|center|right)\1]([^"()?&'<>]*)[/img]/sU";
            
$patterns[] = "/[img]([^"()?&'<>]*)[/img]/sU"
            
$replacements[] = $startdiv.'<img '.$style.' src="\3" '.$enddiv;
            
$replacements[] = $startdiv.'<img '.$style.' src="\3" '.$enddiv;
            
$replacements[] = $startdiv.'<img '.$style.' src="\1" '.$enddiv;
            
// img with  double quotation mark
            
$patterns[] = "/<img src="(.*)" />/sU";             
            
$patterns[] = "/<img src="(.*)" align="(.*)" />/sU";             
            
$replacements[] = $startdiv.'<img '.$style.' src="\1" '.$enddiv;
            
$replacements[] = $startdiv.'<img '.$style.' src="\1" align="\2" '.$enddiv;
            
// img with single quotation mark 
            
$patterns[] = "/<img src=\'(.*)\' />/sU";             
            
$patterns[] = "/<img src=\'(.*)\' align=\'(.*)\' />/sU";             
            
$replacements[] = $startdiv.'<img '.$style.' src="\1" '.$enddiv;
            
$replacements[] = $startdiv.'<img '.$style.' src="\1" align="\2" '.$enddiv;
            
// img without qutation mark
            
$patterns[] = "/<img src=(.*) />/sU";             
            
$patterns[] = "/<img src=(.*) align=(.*) />/sU";             
            
$replacements[] = $startdiv.'<img '.$style.' src="\1" '.$enddiv;
            
$replacements[] = $startdiv.'<img '.$style.' src="\1" align="\2" '.$enddiv;



19
psindia
Re: xoopsCodeDecode
  • 2008/11/24 4:05

  • psindia

  • Not too shy to talk

  • Posts: 171

  • Since: 2005/3/31


use \\2 , \\1 in the replacement string
Please don't visit ==>tenthstone.com!
==>vinodsr.com!

20
Anonymous
Re: xoopsCodeDecode
  • 2008/11/24 5:18

  • Anonymous

  • Posts: 0

  • Since:


hello vinod

I'm using it but not working, I have problem with img tag without qutation mark, for example:

<img src=123.jpg align=right />

this will convert to:

<img src="123.jpg align=right" >

align attribute become insided src attribute.



Login

Who's Online

176 user(s) are online (106 user(s) are browsing Support Forums)


Members: 0


Guests: 176


more...

Donat-O-Meter

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

Latest GitHub Commits