View Full Version : Convert [IMG] to [URL] in quoted text
Hellcat
02-02-2006, 10:00 PM
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) (https://vborg.vbsupport.ru/showpost.php?p=888709&postcount=24)
This one replaces all 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.
[i]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 :)
* Omega Prime clicks install
Tulsa
02-03-2006, 01:22 AM
Still in beta?
I did a quick test of a pic and quoted it and got this...
http://img140.imageshack.us/img140/8140/ritzcarlton8qe.jpg (http://img140.imageshack.us/img140/8140/ritzcarlton8qe.jpg)
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
Still in beta?
I did a quick test of a pic and quoted it and got this...
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 !!
yoooooooooooooooooooooooooooooo
I missed the fisrt post here...
Hellcat rockz like hell..haha
Thnx a Lot
* Zia Kliks Install... is there any way i kliked hundreads of time :D
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
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 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.
$pagetext = str_replace( "[IMG]", "", $pagetext );
$pagetext = str_replace( "", "", $pagetext );
$pagetext = str_replace( "", "", $pagetext );
$pagetext = str_replace( "", "", $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!
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
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
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.
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
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.
* Hellcat smells beer?!?!
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 with in quotes (Apply Userchoice)"
Open it and replace the COMPLETE contents of the plugin with this code:
global $vbulletin;
$ufield = "field" . trim( strval( $vbulletin->options["img2url_ufield"] ) );
if ( $vbulletin->userinfo[$ufield] == "Convert to [*URL]" )
{
$text = preg_replace( "/\[[qQ][mM][gG]\]/", "[[i]url]", $text );
$text = preg_replace( "/\[\/[qQ][iI][mM][gG]\]/", "", $text );
} else {
$text = preg_replace( "/\[[qQ][iI][mM][gG]\]/", "[img]", $text );
$text = preg_replace( "/\[\/[qQ][iI][mM][gG]\]/", "", $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 ;)
Nice.....we r implimenting it
Julie
03-19-2006, 11:23 PM
* Hellcat smells beer?!?!
OK, you sold me :D
Here you go -> Update 1.20 now adds the user option :)
Wicked, thanks :D
*updates*
Can you make it change to thumb instead of url?
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
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.
I'll let the author post the changes. Plus I am sure there is a cleaner way to do it.
jdebler
04-06-2006, 04:32 PM
This is exactly what we are looking for, but....
Is there any way another version can be done that does not have DB changes?
Please?? :)
Boofo
05-11-2006, 08:24 AM
Michael, I use a bbcode tag [img2] for images I want to wrap text around. Will this have any effect on that? I don't want it to, if possible, sir. ;)
Hellcat
05-11-2006, 08:27 AM
@jdebler:
This doesn't change the DB as far as I know....
Everything is done at runtime.
Michael, I use a bbcode tag [img2] for images I want to wrap text around. Will this have any effect on that? I don't want it to, if possible, sir. ;)
This only affects the original [img] tag, nothing else :)
Boofo
05-11-2006, 08:36 AM
This only affects the original [img] tag, nothing else :)
Great! I was thinking you were just doing a replace for img and not looking for [img] (with the closing bracket). ;)
Another great hack by the Master! Keep up the excellent work, sir. ;)
mktrilogy
06-22-2006, 05:28 AM
Can u add features where
- It will not show any links at all at the edit screen
- it will not show links or image, just text at the "post screen"
Much appreciation if it can be integrated.
home9000
06-22-2006, 04:49 PM
I want to remove the option on UserCP
please help
Thanks
Hellcat
06-24-2006, 11:22 AM
I want to remove the option on UserCP
please help
Thanks
Try this:
Find the plugin "Useroption handling" and DISABLE it (only that plugin, not the whole product)
darksoulz
06-24-2006, 09:51 PM
I'm getting Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /admincp/plugin.php(1306) : eval()'d code on line 3 while trying to install. It appears to be assuming that everyone is using mysql functions instead of mysqli.
Darat
08-08-2006, 11:10 AM
Hellcat - Will you be making a 3.6 version of this?
Darat
08-21-2006, 06:20 AM
Just a FYI - one of the keen eyed Members at my forum spotted a spelling mistake in the "field11_desc" phrase, it currently says:
With this option you can choose wether [IMG] tags in quoted text should be shown as [URL] (a link will be displayed instead of the actual quoted image) or should be left as [IMG] (the inline image will be shown).
That's the wrong "wether" - it should be "whether".
EasyTarget
09-27-2006, 04:57 PM
what needs to be changed in the xml file so that this can be used on 3.6 boards?
user02934123123
09-30-2006, 08:14 AM
Any chance of a 3.6 version? Just tried installing on vB 3.6.1, and encountered a db error immediately. Would love the hack, though!
noonespecial
10-09-2006, 09:29 PM
Same - any chance of a 3.6!?
EasyTarget
10-24-2006, 07:01 PM
*bump*
hellcat appears to be inactive but can anyone else who is knowledgeable post a fix for 3.6 please?
Tulsa
11-01-2006, 04:31 PM
This is still functioning fine for me in 3.6.2
I just ran a quick test and the [img] tag was replaced with the [url] tag.
Farjad
12-13-2006, 06:53 PM
This is still functioning fine for me in 3.6.2
I just ran a quick test and the [img] tag was replaced with the [url] tag.
Mines is too, but it won't directly import on 3.6.X
yingzhou
12-15-2006, 03:21 AM
How to use it in 3.6.x?
beano33
12-22-2006, 05:14 PM
I'd like to see this ported to 3.6.x too.
hello,,
any one using it with vb 3.6.4 ??
tankaya61
01-16-2007, 01:04 PM
hello,,
any one using it with vb 3.6.4 ??
doesn't work 3.6.4
Nudda
02-25-2007, 11:54 PM
shame, another useful 3.5 hack, unable to be ported to 3.6 due to inactive developer
oldengine
02-26-2007, 02:55 AM
Here's another site owner that would use it.
Gizmo999
02-26-2007, 12:26 PM
it works on my 3.6.4 install......
it works on my 3.6.4 install......
and theres no one to taking care of it
Gizmo999
03-04-2007, 07:08 PM
and theres no one to taking care of it
sorry, i don't understand?
serhat_kk
03-04-2007, 07:25 PM
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?
Same at 3.5.4... Can someone help?
Gizmo999
03-05-2007, 09:05 PM
er, i think i may have hacked the plugin code, i can't remember now :( AIR when i upgraded it didn't work correctly, it converted the img to url and left an extra character in the url, i'll see if i can find time to compare my code
Adam21
06-27-2007, 12:22 PM
Any ideas on how to make this work for 3.6+?Its quite a useful mod!
It seems to work for me in 3.6.8
El Orans
12-19-2007, 07:11 PM
Bummer.
3.6.8. won't install it. :(
Aeolian
12-20-2007, 01:23 PM
same for vB 3.7 B2 ...
TrickyD
01-24-2008, 11:05 PM
i ran this install on 3.6.5 and now i'm getting vbulletin errors when people are registering.
Database error in vBulletin 3.6.5:
Invalid SQL:
UPDATE cmq_userfield SET
field1 = '',
field2 = '',
field3 = '',
field4 = '',
field16 = '',
field18 = '',
field7 = '',
field12 = '',
field8 = '',
field14 = '',
field13 = '',
field10 = '',
field15 = '',
field6 = '',
field19 = '',
field20 = 'Convert to [url]'
WHERE userid = 14397;
MySQL Error : Unknown column 'field20' in 'field list'
Error Number : 1054
Date : Tuesday, January 22nd 2008 @ 08:15:31 PM
Script : http://www.ncaastrategies.com/utopia/admincp/user.php?do=update
Referrer : http://www.ncaastrategies.com/utopia/admincp/user.php?do=edit&u=14397
IP Address : 71.115.217.253
Username : gohuskies
Classname : vb_database
anyone have any thoughts on fixing that?
furst
03-25-2008, 05:36 AM
I can't believe there's no working hack out for this right now.
Artes_Marciales
07-15-2008, 11:28 AM
Any similar mod for 3.7 ?? :confused:
S@NL - BlackBik
04-08-2009, 07:12 PM
I just upgraded from 3.5.3 to 3.8.2 and this hack still works :)
Artes_Marciales
04-09-2009, 06:51 AM
Data Base ERROR in 3.8.2 :(
strength
06-30-2009, 02:11 PM
Data Base ERROR in 3.8.2 :(
+1 same
:(
SlimSoldier
07-06-2009, 02:48 PM
would like to see this working in the newest version also
karabaja3
10-23-2010, 06:05 PM
I installed this plugin at 3.5.x. It worked perfectly after all VB upgrades including 3.8.6. PL1
But when I tryed to install this plugin into new and clean install of 3.8.6. PL1 I recived this error:
MySQL Error : Unknown column 'title' in 'field list'
Why? Can this be solved?
karabaja3
11-11-2010, 12:28 AM
Anyone?
karabaja3
02-03-2011, 09:08 PM
Please, anyone?
tdev1
03-14-2011, 06:28 AM
updated: https://vborg.vbsupport.ru/showthread.php?p=2173151
should also work with VB 3.x
karabaja3
03-15-2011, 01:08 AM
updated: https://vborg.vbsupport.ru/showthread.php?p=2173151
should also work with VB 3.x
Thank you!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.