Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2017, 08:04 AM
mobster46 mobster46 is offline
 
Join Date: Dec 2016
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 02-05-2017, 08:42 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']); 
Reply With Quote
Благодарность от:
z3r0
  #3  
Old 02-08-2017, 05:47 PM
Stratis's Avatar
Stratis Stratis is offline
 
Join Date: Jan 2010
Posts: 738
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Thanks in advanced
Reply With Quote
  #4  
Old 02-10-2017, 04:12 AM
mobster46 mobster46 is offline
 
Join Date: Dec 2016
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFL View Post
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
Reply With Quote
  #5  
Old 02-10-2017, 04:36 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mobster46 View Post
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.
Reply With Quote
  #6  
Old 02-10-2017, 07:31 AM
mobster46 mobster46 is offline
 
Join Date: Dec 2016
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFL View Post
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
Reply With Quote
  #7  
Old 02-13-2017, 02:52 PM
Stratis's Avatar
Stratis Stratis is offline
 
Join Date: Jan 2010
Posts: 738
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mobster46 View Post
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
Reply With Quote
Благодарность от:
MarkFL
  #8  
Old 02-13-2017, 04:34 PM
mobster46 mobster46 is offline
 
Join Date: Dec 2016
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Stratis View Post
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] ---------------



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



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

ok ı see. sory

true?

$content = preg_replace('/\[URL\](http.*?\.png)\[\/URL\]/i', '', $post['pagetext']);
$content = preg_replace('/\[URL\](http.*?\.jpg)\[\/URL\]/i', '', $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']);
}
Reply With Quote
Благодарность от:
Stratis
  #9  
Old 02-16-2017, 03:46 PM
BadgerDog BadgerDog is offline
 
Join Date: Oct 2006
Location: Toronto
Posts: 1,789
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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', '', $post['pagetext']);
$content = preg_replace('/\[URL\](http.*?\.jpg)\[\/URL\]/i', '', $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
Reply With Quote
  #10  
Old 02-16-2017, 04:12 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']); 
Reply With Quote
Благодарность от:
Stratis
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:21 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.07749 seconds
  • Memory Usage 2,277KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (4)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete