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)

mobster46 02-05-2017 08:04 AM

Png link auto embed(convert)
 
How can I automatically convert a picture when I add a link?

For example
http://travian-reports.net/tr/img/154441a5f4e.png

I do not want it to appear as a link.

I find auto youtube embed(https://vborg.vbsupport.ru/showthread.php?t=261296)
but ı dont find image link convert.

MarkFL 02-05-2017 08:42 AM

Create a plugin hooked at "postbit_display_start" with the code:

PHP Code:

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


Stratis 02-08-2017 05:47 PM

Mark to include more, png, gif, jpeg, etc ?

Thanks in advanced :)

mobster46 02-10-2017 04:12 AM

Quote:

Originally Posted by MarkFL (Post 2581852)
Create a plugin hooked at "postbit_display_start" with the code:

PHP Code:

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


Mark to include more, png, gif, jpeg, etc ?

Thanks in advanced

MarkFL 02-10-2017 04:36 AM

Quote:

Originally Posted by mobster46 (Post 2582134)
Mark to include more, png, gif, jpeg, etc ?

Thanks in advanced

You may recall I had to add some code because of post caching...please post the entire content of the plugin I put on your site, and I will modify it to include more file extensions. :)

mobster46 02-10-2017 07:31 AM

Quote:

Originally Posted by MarkFL (Post 2582136)
You may recall I had to add some code because of post caching...please post the entire content of the plugin I put on your site, and I will modify it to include more file extensions. :)

I do not know what you add: D

Stratis 02-13-2017 02:52 PM

Quote:

Originally Posted by mobster46 (Post 2582137)
I do not know what you add: D

admincp

Plugins & Products -> Plugin Manager -> You must remember the title to see it, maybe at top.
Read and i thing you will understand which is..

* If you press on the title you will see the code :)

mobster46 02-13-2017 04:34 PM

Quote:

Originally Posted by Stratis (Post 2582265)
admincp

Plugins & Products -> Plugin Manager -> You must remember the title to see it, maybe at top.
Read and i thing you will understand which is..

* If you press on the title you will see the code :)

There is not.

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

https://vborg.vbsupport.ru/external/2017/02/7.png

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

https://vborg.vbsupport.ru/external/2017/02/8.png

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

ok ı see. sory

true?

$content = preg_replace('/\[URL\](http.*?\.png)\[\/URL\]/i', 'https://vborg.vbsupport.ru/', $post['pagetext']);
$content = preg_replace('/\[URL\](http.*?\.jpg)\[\/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']);
}

BadgerDog 02-16-2017 03:46 PM

This looks interesting ..

So, for clarity, if I create a plugin titled with some name and hooked at "postbit_display_start" with the code:

Quote:

$content = preg_replace('/\[URL\](http.*?\.png)\[\/URL\]/i', 'https://vborg.vbsupport.ru/', $post['pagetext']);
$content = preg_replace('/\[URL\](http.*?\.jpg)\[\/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']);
}
Then the site will automatically display all links that were PNG and JPG as pictures?

Regards,
Doug

MarkFL 02-16-2017 04:12 PM

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']); 



All times are GMT. The time now is 03:28 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.01305 seconds
  • Memory Usage 1,747KB
  • 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
  • (3)bbcode_php_printable
  • (6)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
  • (10)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