vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Png link auto embed(convert) (https://vborg.vbsupport.ru/showthread.php?t=324373)

BadgerDog 02-16-2017 04:15 PM

Quote:

Originally Posted by MarkFL (Post 2582460)
What you would want for the first line is:

PHP Code:

$content preg_replace('/\[URL\](http.*?\.(png|jpg|gif))\[\/URL\]/i''[img]https://vborg.vbsupport.ru/[/img]'$post['pagetext']); 


Thank you Mark ... :)

You are always so gracious and helpful on this site... :up:

Regards,
Doug

Stratis 02-16-2017 05:14 PM

Quote:

Originally Posted by MarkFL (Post 2582460)
What you would want for the first line is:

PHP Code:

$content preg_replace('/\[URL\](http.*?\.(png|jpg|gif))\[\/URL\]/i''[img]https://vborg.vbsupport.ru/[/img]'$post['pagetext']); 


is this the final?

Code:

$content = preg_replace('/\[URL\](http.*?\.(png|jpg|gif))\[\/URL\]/i', 'https://vborg.vbsupport.ru/', $post['pagetext']);
if ($content != $post['pagetext'])
 {
 global $vbulletin;
 $pagetext = $content;
require_once(DIR . '/includes/class_bbcode.php');
 $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
 $post['pagetext_html'] = $bbcode_parser->parse($pagetext, $post['forumid'], 1);
 $post['pagetext_html'] = html_entity_decode($post['pagetext_html']);
 }

because in post #2 you do not have all this code :)

Thank you very much

MarkFL 02-16-2017 05:21 PM

Quote:

Originally Posted by Stratis (Post 2582464)
is this the final?

Code:

$content = preg_replace('/\[URL\](http.*?\.(png|jpg|gif))\[\/URL\]/i', 'https://vborg.vbsupport.ru/', $post['pagetext']);
if ($content != $post['pagetext'])
 {
 global $vbulletin;
 $pagetext = $content;
require_once(DIR . '/includes/class_bbcode.php');
 $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
 $post['pagetext_html'] = $bbcode_parser->parse($pagetext, $post['forumid'], 1);
 $post['pagetext_html'] = html_entity_decode($post['pagetext_html']);
 }

because in post #2 you do not have all this code :)

Thank you very much

Post #2 was what worked on my local dev site, but then I realized it worked for me because I have post caching turned off there...so, I revised the code to reparse the post for the OP, who has post caching turned on.

Stratis 02-16-2017 05:59 PM

Ok, I have "Cached Posts Lifespan" to zero (0)
so i will use the first line. Thanks Mark.

MarkFL 02-16-2017 06:12 PM

Quote:

Originally Posted by Stratis (Post 2582469)
Ok, I have "Cached Posts Lifespan" to zero (0)
so i will use the first line. Thanks Mark.

In that case, you would want:

PHP Code:

$post['pagetext'] = preg_replace('/\[URL\](http.*?\.(png|jpg|gif))\[\/URL\]/i''[img]https://vborg.vbsupport.ru/[/img]'$post['pagetext']); 

:)

Stratis 02-16-2017 06:19 PM

Yes, Yes :)

--------------- Added [DATE]1487278112[/DATE] at [TIME]1487278112[/TIME] ---------------

I forgot to ask, I want to recognize when link images turn to img, is there a way to put in code some title that I would like and to show at the bottom of the image?

or attribute to see when hover image :D

BadgerDog 02-21-2017 12:22 PM

Ok, for my clarity and so I don't screw it up ... :)

Is this the code I need to use to create the plugin discussed?

Quote:

$post['pagetext'] = preg_replace('/\[URL\](http.*?\.(png|jpg|gif))\[\/URL\]/i', 'https://vborg.vbsupport.ru/', $post['pagetext']);
if ($content != $post['pagetext'])
{
global $vbulletin;
$pagetext = $content;
require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$post['pagetext_html'] = $bbcode_parser->parse($pagetext, $post['forumid'], 1);
$post['pagetext_html'] = html_entity_decode($post['pagetext_html']);
}
Thanks .. :)

Regards,
Doug

MarkFL 02-21-2017 12:52 PM

Quote:

Originally Posted by BadgerDog (Post 2582699)
Ok, for my clarity and so I don't screw it up ... :)

Is this the code I need to use to create the plugin discussed?



Thanks .. :)

Regards,
Doug

You want:

PHP Code:

$content preg_replace('/\[URL\](http.*?\.(png|jpg|gif))\[\/URL\]/i''[img]https://vborg.vbsupport.ru/[/img]'$post['pagetext']);

if (
$content != $post['pagetext'])
{
    global 
$vbulletin;
    
$pagetext $content;
    require_once(
DIR '/includes/class_bbcode.php');
    
$bbcode_parser = new vB_BbCodeParser($vbulletinfetch_tag_list());
    
$post['pagetext_html'] = $bbcode_parser->parse($pagetext$post['forumid'], 1);
    
$post['pagetext_html'] = html_entity_decode($post['pagetext_html']);



BadgerDog 02-21-2017 01:10 PM

Quote:

Originally Posted by MarkFL (Post 2582700)
You want:

PHP Code:

$content preg_replace('/\[URL\](http.*?\.(png|jpg|gif))\[\/URL\]/i''[IMG]$1[/IMG]'$post['pagetext']);

if (
$content != $post['pagetext'])
{
    global 
$vbulletin;
    
$pagetext $content;
    require_once(
DIR '/includes/class_bbcode.php');
    
$bbcode_parser = new vB_BbCodeParser($vbulletinfetch_tag_list());
    
$post['pagetext_html'] = $bbcode_parser->parse($pagetext$post['forumid'], 1);
    
$post['pagetext_html'] = html_entity_decode($post['pagetext_html']);



Thanks again .. :up:

Regards,
Doug


All times are GMT. The time now is 01:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01405 seconds
  • Memory Usage 1,769KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete