X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=15b2ebb0a55c185e698476b2a07845cd8a91e634;hb=513c1c0d683fc770de7d9a78e0a83df9211bb4aa;hp=8c565add6ccceff9a86da833822b9485e5716589;hpb=0130052b2cfde6ca888506807c1b5e7e61209151;p=friendica.git diff --git a/include/bbcode.php b/include/bbcode.php index 8c565add6c..15b2ebb0a5 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -30,6 +30,24 @@ function tryoembed($match){ function bbcode($Text,$preserve_nl = false) { + + // Extract a single private image which uses data url's since preg has issues with + // large data sizes. Stash it away while we do bbcode conversion, and then put it back + // in after we've done all the regex matching. We cannot use any preg functions to do this. + + $saved_image = ''; + $img_start = strpos($Text,'[img]data:'); + $img_end = strpos($Text,'[/img]'); + + if($img_start !== false && $img_end !== false && $img_end > $img_start) { + $start_fragment = substr($Text,0,$img_start); + $img_start += strlen('[img]'); + $saved_image = substr($Text,$img_start,$img_end - $img_start); + $end_fragment = substr($Text,$img_end + strlen('[/img]')); +// logger('saved_image: ' . $saved_image,LOGGER_DEBUG); + $Text = $start_fragment . '[$#saved_image#$]' . $end_fragment; + } + // If we find any event code, turn it into an event. // After we're finished processing the bbcode we'll // replace all of the event code with a reformatted version. @@ -99,12 +117,16 @@ function bbcode($Text,$preserve_nl = false) { if(stristr($Text,'[/list]')) $Text = str_replace("[*]", "