vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Convert [IMG] to [URL] in quoted text (https://vborg.vbsupport.ru/showthread.php?t=107022)

Hellcat 02-02-2006 10:00 PM

Convert [IMG] to [URL] in quoted text
 
OK, another quick one I made 'cause someone requested something like this and I didn't find it while looking for it :)
So, forgive me if something like this already exists.... :nervous:
(Point of reference)

This one replaces all [IMG] tags in quoted text with [URL] tags.
So, you and your users don't have to see the same image over and over again, and if you really forgot what the image was, just click the link :D

Installation:
Import the product .XML -> DONE :)


Like I said, a quick one.


Update 1.20
By request, this now also adds an option to the UserCP where users can choose if quoted images should be converted to URLs or left as images.

UserCP -> Edit Options -> At the bottom of the page

:)

Tulsa 02-03-2006 12:19 AM

Very needed, thanks.

Daniel 02-03-2006 12:41 AM

Indeed! Thanks.

Omega Prime 02-03-2006 12:52 AM

Another nice feature to have :)

[high]* Omega Prime clicks install[/high]

Tulsa 02-03-2006 01:22 AM

Still in beta?

I did a quick test of a pic and quoted it and got this...

PHP Code:

[quote=Tulsa]

[
URL="http://img140.imageshack.us/img140/8140/ritzcarlton8qe.jpg"][IMG]http://img140.imageshack.us/img140/8140/ritzcarlton8qe.jpg[/IMG][/URL][/quote] 

It appears to have doubled it, left the img tags and tacked on the url tags at the ends?

Hellcat 02-03-2006 02:01 AM

Quote:

Originally Posted by Tulsa
Still in beta?

I did a quick test of a pic and quoted it and got this...

PHP Code:

 

It appears to have doubled it, left the img tags and tacked on the url tags at the ends?

Do you have any other things installed that alter [IMG] tags or such?
Because there is no way this one could double it since all it does is replacing "IMG" by "URL"....

Tulsa 02-03-2006 02:22 AM

Not that I'm aware of? What else might alter img tags?

Tulsa 02-03-2006 02:31 AM

Maybe this was just some kind of fluke?? Someone on my sight just quoted a pic and it worked fine.

Update:
I'm not sure this is going to make any sense at all but it appears to only be happening when you are quoting a pic hosted from imageshack or photobucket??

Other sources of pics from other servers work fine?

incurable 02-03-2006 03:43 AM

gosh this is neat !!! i need it !!

Zia 02-03-2006 06:19 AM

yoooooooooooooooooooooooooooooo
I missed the fisrt post here...

Hellcat rockz like hell..haha

Thnx a Lot

[high]* Zia Kliks Install... is there any way i kliked hundreads of time :D[/high]

S@NL - BlackBik 02-03-2006 06:49 AM

I was patiently waiting for this to be ported to 3.5 :)
Installed.

But it only seems to work on NEW quotes.
Excisting quotes with images in it are unaffected.
Well, it's better than nothing, but it would be cool if this could be made.

Hellcat 02-03-2006 07:00 AM

Indeed, this only affects new quotes.

The old ones will vanish quite soon on the mysterious "page 2" anyway ;)

S@NL - BlackBik 02-03-2006 07:34 AM

Page 2? Who the f*ck reads page 2? :D
You're right. Thanks for your reply.

Snake 02-03-2006 06:42 PM

Double thanks!

Tralala 02-04-2006 05:44 AM

I just imported this product .XML, and tried it on my board (running 3.5.3.) Tried quoting an IMG and nothing changed, it kept it as an IMG and didn't convert it to a URL. Any ideas?

Tulsa 02-04-2006 07:25 AM

Quote:

Originally Posted by Tulsa
Maybe this was just some kind of fluke?? Someone on my sight just quoted a pic and it worked fine.


Update:
I'm not sure this is going to make any sense at all but it appears to only be happening when you are quoting a pic hosted from imageshack or photobucket??

Other sources of pics from other servers work fine?

Okay, I know what the issue is now. When people are using ImageShack or PhotoBucket to host pics, those services provide the links complete with the image tags to paste into a post, they are providing all caps [IMG] tags and this hack is replacing only [img] tags.

I went in and edited both locations in the plug-in manager as a test and copied the code and duplicated it, replacing only the [img] with [IMG] (all caps) and it's now working perfectly.

I'm no coder and I'm sure theres a cleaner way to do this but as a quick test to determine the issue this worked rather nicely.


PHP Code:

$pagetext str_replace"[IMG]""[url]"$pagetext );
$pagetext str_replace"[/IMG]""[/url]"$pagetext );
$pagetext str_replace"[img]""[url]"$pagetext );
$pagetext str_replace"[/img]""[/url]"$pagetext ); 


Hellcat 02-04-2006 07:38 AM

Whoops, you're right....

I'll post an updated version laster today that is not case sensitive!

lolo? 02-06-2006 09:15 AM

thanks clic install

dutchbb 02-06-2006 10:21 AM

this is a great idea, will be using this thanks!

Zia 02-06-2006 12:52 PM

a new upgrade is comming very soon...
that will works with
[IMG] , [img] , [iMG] , [Img] any way ..new release will work with all..

Thnx

Hellcat 02-06-2006 02:23 PM

OK,here comes the update :)

I replaced the "plain search and replace" by a regular expression - resulting in case INsesitive replace :up:
So, [img], [IMG], [imG].... whatever, should be propperly replaced by [url] now.

To update, just re-import the new product .XML with the "allow overwrite" option enabled and you're set.

EasyTarget 02-06-2006 03:06 PM

/me installs

S@NL - BlackBik 02-06-2006 08:35 PM

Thanks for the update, Hellcat :)

Hellcat 02-06-2006 08:39 PM

Quote:

Originally Posted by S@NL - BlackBik
Thanks for the update, Hellcat :)

A pleasure (as long as some1 really uses it ;)) :)

S@NL - BlackBik 02-06-2006 08:53 PM

I sure am, and it's working fine :)

EasyTarget 02-07-2006 03:48 AM

hey if you are up for challenges hellcat, I have a good one for ya :p

It would be similar to this mod, but with a more general application. On my board there's lots of people that link to pictures from other sites. This is ok for awhile, but soon the original picture is deleted leaving the post with the signature x.

I was wondering if you could add to this hack or start a new one which would let the admin run a scheduled task every so often which would search all new posts for images and add when it finds posts with images it would find out if it was hosted at a remote site or not, and if it was then it would convert it to a forum attachment in that post or copy/host the image in a folder specified by the admin and relink the img tag to the new location. And if the admin can add exempt urls that'd be beneficial too I'm sure.

Anyways, just something I've had on my mind for awhile :p

Julie 02-09-2006 12:47 AM

Nice little thing, which is very much needed indeed! Thank you! :)

Slacker 02-09-2006 04:25 AM

Just what I needed! Installed, thanks!

http://boards.slackercentral.com

Tralala 02-09-2006 05:49 PM

Curious for feedback on this. Does installing this actually decrease load on the forum's server in any way, or is it more of an "aesthetic" decision?

(I realize it could speed things up for the user side rendering and display of image-heavy threads, but I'm of the mindset that it wouldn't have any effect, really, on the forum server itself. Am I wrong?)

That said, some users really don't like this. At all. Any chance it could be made a user-selectable option? That would please everyone, one would think.

Hellcat 02-09-2006 09:10 PM

This has no affect on the forum's server, except when most of the images are hosted on the forum server itself, wich usually isn't the case.

Adding an user option would be possible, yes.

Tralala 02-09-2006 10:48 PM

Quote:

Originally Posted by Hellcat
This has no affect on the forum's server, except when most of the images are hosted on the forum server itself, wich usually isn't the case.

Yeah, that's what I thought. Thanks for the confirmation.

Quote:

Originally Posted by Hellcat
Adding an user option would be possible, yes.

Cool. Well, count me in as someone who'd really appreciate that feature for a future version. Got PayPal? I'd even send a few bones your way to enjoy some beers on me.

/subscribes to thread

Parham 02-10-2006 09:21 AM

Great [ Installed ]

Hellcat 02-10-2006 06:27 PM

Quote:

Originally Posted by Tralala
Cool. Well, count me in as someone who'd really appreciate that feature for a future version. Got PayPal? I'd even send a few bones your way to enjoy some beers on me.

[high]* Hellcat smells beer?!?!
[/high]

OK, you sold me :D
Here you go -> Update 1.20 now adds the user option :)

Tralala 02-10-2006 10:33 PM

Mod installed, beer money sent.

Thanks, Hellcat!

Hellcat 02-11-2006 05:04 PM

To make it the default behaviour to display the images in quoted text and only convert them to URLs if so choosen, in the Plugin-Manager find the Plugin:
"Replace [IMG] with in quotes (Apply Userchoice)http://"<br /> <br /> Open it and ...</div> </div>
PHP Code:

", $text );
} else {
  
$text = preg_replace( "/\[[qQ][iI][mM][gG]\]/", "[img]", $text );
  
$text = preg_replace( "/\[\/[qQ][iI][mM][gG]\]/", "[/img]", $text );


If the user didn't make any choice so far the images will be left intact now.

IMPORTANT: Please remove the "*" from the "[*URL]" in the IF clause.
I had to put that in there, or else the threaddisplay would mess up this post ;)

Zia 02-13-2006 08:14 AM

Nice.....we r implimenting it

Julie 03-19-2006 11:23 PM

Quote:

Originally Posted by Hellcat
[high]* Hellcat smells beer?!?!
[/high]

OK, you sold me :D
Here you go -> Update 1.20 now adds the user option :)

Wicked, thanks :D

*updates*

EdQ 03-27-2006 05:26 PM

Can you make it change to thumb instead of url?

EdQ 03-27-2006 06:37 PM

Quote:

Originally Posted by EdQ
Can you make it change to thumb instead of url?

I just changed the code to thumb. Seems to work great. Thanks for the plugin. :)

Tralala 03-27-2006 07:37 PM

Quote:

Originally Posted by EdQ
I just changed the code to thumb. Seems to work great. Thanks for the plugin. :)

Oooh, care to share? That'd be a really nice new option.


All times are GMT. The time now is 05:22 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.01535 seconds
  • Memory Usage 1,834KB
  • 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
  • (5)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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