Resource icon

Post Content Find / Replace 2.0.1

No permission to download
yeah. i was trying to find expression for renaming all Imgur hosted PNGs to WebPs. just couldn't get it to work. would be great if this addon is fixed and someone can guide me on this particular requirement. cheers!
 
yeah. i was trying to find expression for renaming all Imgur hosted PNGs to WebPs. just couldn't get it to work. would be great if this addon is fixed and someone can guide me on this particular requirement. cheers!
You can give some examples of URL?
 
psa. i wouldn't run this command right now because ios and macos users do not yet have the ability to see webp images. but they would in a few months (at least for the ones who upgrade to latest versions which basically means 99.99% of the few of my apple device users). so i am just looking for the code to save to run sometime later this year.

example:
convert https://i.imgur.com/nWlNtXd.png to https://i.imgur.com/nWlNtXd.webp

with wildcard:
convert imgur.com/*.png to imgur.com/*.webp

imgur basically keeps a webp version of all images hosted on their platform. webp images are much smaller in size compared to PNGs and also JPEGs. so i can basically shrink most (non-GIF) hotlinked image from their platform with just one command. xenforo proxy also does not support webp, so this only works if you have that disabled (or supported is added in one of the 2.2.x series in future).

one issue here is that imgur file name length has increased over the years. i think early on it was five character long. now it is seven. plus there are variants for different dimensions so... the file name is not fixed. could range from 5 characters to 8.



also of course, another unanswered query of mine from previous page is whether this tool can be used to remove all tinypic images because they are all dead now. same with imageshack i assume. thanks all!
 
so... is there a simple method to remove all tinypic bbcodes from the post content through the forum! a sample code is like this:
[IMG]http://i64.tinypic.com/2zgg086.jpg[/IMG]

thanks!

This might work:


Code:
/\[IMG\]http:\/\/i64\.tinypic\.com\/(.*?)\[\/IMG\]/i

But only looks for http://i64.tinypic.com/SOMEFILENAME

Proceed with caution. I haven't tested on a large database.
 
would test it out. there are likely to be 10s of subdomains. so i can kill them as i encounter them. but is the addon even working on 2.1.x because all recent comments say that it gives out an error. thanks!

alright. so i kept replacement field empty. and this was the result without save option.

1594845879295.webp

this seems accurate right? this would basically replace this bbcode with nothing? addon is indeed working and this code would help a lot! thanks.
 
psa. i wouldn't run this command right now because ios and macos users do not yet have the ability to see webp images. but they would in a few months (at least for the ones who upgrade to latest versions which basically means 99.99% of the few of my apple device users). so i am just looking for the code to save to run sometime later this year.

example:
convert https://i.imgur.com/nWlNtXd.png to https://i.imgur.com/nWlNtXd.webp

with wildcard:
convert imgur.com/*.png to imgur.com/*.webp

imgur basically keeps a webp version of all images hosted on their platform. webp images are much smaller in size compared to PNGs and also JPEGs. so i can basically shrink most (non-GIF) hotlinked image from their platform with just one command. xenforo proxy also does not support webp, so this only works if you have that disabled (or supported is added in one of the 2.2.x series in future).

one issue here is that imgur file name length has increased over the years. i think early on it was five character long. now it is seven. plus there are variants for different dimensions so... the file name is not fixed. could range from 5 characters to 8.



also of course, another unanswered query of mine from previous page is whether this tool can be used to remove all tinypic images because they are all dead now. same with imageshack i assume. thanks all!
again, proceed with caution


Code:
/\[img\]https:\/\/i\.imgur\.com\/(.*?)\.(jpg|png)\[\/img\]/i
Code:
Replace with:

[img]https://i.imgur.com/\1.webp[/img]

This converts i.imgur.com/filename.jpg or i.imgur.com/filename.png to i.imgur.com/filename.webp
if it's in img tags.

Are you sure all jpg/png's have webp equivalents ?

I don't know if the plugin works. I haven't used it in a while.
 
Are you sure all jpg/png's have webp equivalents ?
i have tested some of the oldest images and all of them work with webp. i mean they are being generated on the fly for display on their frontend on compatible browsers. i have seen their homepage load webp while the actual image pages load the regular version.

1594846303217.webp

it is a safe gamble in any case because i can rename the files back to jpegs and they would load just fine. (all images work with jpg/gif/png/webp extensions on imgur!)
 
i have tested some of the oldest images and all of them work with webp. i mean they are being generated on the fly for display on their frontend on compatible browsers. i have seen their homepage load webp while the actual image pages load the regular version.

View attachment 230484

it is a safe gamble in any case because i can rename the files back to jpegs and they would load just fine. (all images work with jpg/gif/png/webp extensions on imgur!)

Use this to test it


It lets you do a live regex replace. So you can try the regex. See if all the images seem to work. Before you commit to a database change.

arn
 
/\[img\]https:\/\/i\.imgur\.com\/(.*?)\.(jpg|png)\[\/img\]/i
this shows preview as expected! thanks. would probably do jpg and png separately because of the sheer number of files. would use the regex editor to modify this code. thanks again!

live regex replace also seems wonderful. would be great for testing!
 
  • Like
Reactions: arn
so there are a lot of old orphaned code in the form of [video=youtube;XXXXXXXXXX]. how do i clean this up! thanks.
 
that's the thing. videos are embedded. i assume i did run some commands when i migrated from ipb to xf years ago. this orphan code appears before the video. example

so just need to get rid of this. i cannot do this with sql because the XXXXX bit is unique. so need regex code for this addon. thanks!
 
I need remove the all image url's with their IMG tags from my all posts.
Because, image domain assigned with "Malicious or unwanted software"

When i trying to delete my specific domain on images from database with their [IMG bbcode,

My Solution is;
quick find : domain-cdn
find : /\[IMG\](.?)\.domain-cdn(.?)\[\/IMG\]/i
replace:

Results are right on test mode, but after i click the "save changes" mode, it gives error on xenforo 2.1.10

Ekran Resmi 2020-08-07 13.19.35.webp

So plugin doesn't work with 2.1.10 anymore ?
 
Last edited:
If I do a quick search I also get

ErrorException: [E_WARNING] preg_match_all(): Empty regular expression in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41

@Chris D, this addon is broken and unusable for large forums.​

For our big board, i can search and see the results perfectly.
However, i can't run in the realtime for replacing the text, only test mode works.

I think, that add-on doesn't complatible with xenforo 2.1.10 anymore @Chris D , isn't it ?
 
Same error on XF 2.2 beta 3
ErrorException: [E_WARNING] preg_match_all(): Empty regular expression in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41
  1. XF::handlePhpError()
  2. preg_match_all() in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41
  3. XFPR\Admin\Controller\PostReplace->actionReplace() in src/XF/Mvc/Dispatcher.php at line 350
  4. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
  5. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
  6. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
  7. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2298
  8. XF\App->run() in src/XF.php at line 459
  9. XF::runApp() in admin.php at line 13
 
Can someone please tell me if this is going to be possible.

I have one user who has posted a lot of smilies from his photobucket album and I want to remove them (ie replace with nothing)

He has in every case linked the image to the actual image page on photobucket so the bbcode is like this:

Code:
[URL='http://s195.photobucket.com/user/Colin_the_bear/media/billybargain_37741_8229.gif.html'][IMG]http://i195.photobucket.com/albums/z28/Colin_the_bear/billybargain_37741_8229.gif[/IMG][/URL]

All of these are identical apart form the actual image.

So I'm wondering if there is a regex that will ideally remove the lot in one go (ie with wildcard for the image name) . But as there are many of each smilie, and maybe only only 20 different ones I'd be happy to do it one by one.

Can anyone help with this please?
 
Top Bottom