Word censoring [to change image file extension]

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Scam Warning
User avatar
sebo
Registered User
Posts: 56
Joined: Mon Jan 22, 2024 10:28 pm

Word censoring [to change image file extension]

Post by sebo »

Hello everyone!!

I have a "problem" with word censoring.
I'm running versione 3.3.10 on SQL.

i would like to censor a part of a word:
i'm changing all of my images to webp format (not the forum's, but the images posted in topics) but i have to change links to images in the forum too, from .jpg to .webp
:idea: so i tought: word censoring is the solution!! (not the best but in the meantime i found another way...) :oops:

But when i use it, it works only with the single word ".jpg" not for "image.jpg"
So i tried to censor "*.jpg"...but "image.jpg" become ".webp"....is there any method to change "image.jpg" in forum into "image.webp"? :?

thanks in advance :roll:
Last edited by Mick on Thu Jan 25, 2024 9:18 am, edited 2 times in total.
Reason: Solved.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6611
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Word censoring

Post by thecoalman »

If you have very specific file names you can do this using phpMyadmin. First make a full backup of your database. Open phpMyadmin from your hosting control panel. Open the *phpbb*_posts table. There should be tab on the top for search, click it. Click the button Find and Replace.

*phpbb_ is default prefix, yours may be different. Just be aware you need to be careful with this, replacing cat with dog will turn catastrophe into dogastrophe
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
sebo
Registered User
Posts: 56
Joined: Mon Jan 22, 2024 10:28 pm

Re: Word censoring

Post by sebo »

yes, i was thinking about that in a sql command like

Code: Select all

UPDATE ******
SET ******* = REPLACE(********, '.jpg', '.webp')
WHERE ***** LIKE '%.jpg%';
but like you just wrote...maybe it would be very a catastrophe...or dogastrophe?!?! :|


edit.
:idea: now that you wrote the "specific" word i was thinking about it...
actually all the links i want to change are in a BBcode i've used in years.

the bbcode is:
[imgrz]image.jpg[/imgrz]

that makes some changes in the link of the image to view it in the forum... it would be great if i can change only the word inside the bbcode. :idea:
i cannot change the bbcode beacuse is structured like

Code: Select all

[imgrz]{TEXT}[/imgrz]
so the .jpg is inside the {TEXT}...but that could be a good way to search it in the db...!

is there any other idea to change this without changing my db?
really thanks!! :D
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6611
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Word censoring [to change image file extension]

Post by thecoalman »

If it's in a bbcode it should be fairly simple. If you follow the directions I gave you it should give you preview of about 10 posts before committing.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
sebo
Registered User
Posts: 56
Joined: Mon Jan 22, 2024 10:28 pm

Re: Word censoring [to change image file extension]

Post by sebo »

i've tryied in a backup...if I search the tag i posted

Code: Select all

.jpg[/imgrz]
there are a few results in the column you mentioned.

it's strange...so i decided to search manually...and i found that my bbcode is saved differently in the DB:

Code: Select all

.jpg<e>[/imgrz]
is that correct? searching this query there are 20000 results...maybe that's it!
it seems that it has start and end :?:

Code: Select all

[imgrz]<s>image.jpg<e>[/imgrz]
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26888
Joined: Fri Aug 29, 2008 9:49 am

Re: Word censoring

Post by Mick »

sebo wrote: Tue Jan 23, 2024 11:32 pmis there any other idea to change this without changing my db?
You could consider testing on a local server? See Knowledge Base - Installing and Setting Up Your Own Web Server.

You could then make a copy of your board and play with it as you wish without any worries of distemper. Personally I’d make a copy of the database in SQL (text) form and user my proper text editor and do a find and replace then test on my local server.
  • "The more connected we get the more alone we become” - Kyle Broflovski© 🇬🇧
User avatar
sebo
Registered User
Posts: 56
Joined: Mon Jan 22, 2024 10:28 pm

Re: Word censoring [to change image file extension]

Post by sebo »

thanks, i know XAMPP and use it for testing, but i use it most for quite empty db.

i know that the process is faster and safer in local, but i don't even like to "bump" everytime my db to upload it online.

there are 180.000 rows in the post table, usually i prefer to do a backup and correct it online. in case of disaster i upload the backup... :?
do you suggest me to do on xampp this time? do you think the online shared server will timeout to change all the rows?
can i upload only the correction uploading only the phpbb3_post table?
User avatar
warmweer
Jr. Extension Validator
Posts: 12094
Joined: Fri Jul 04, 2003 6:34 am
Location: somewhere in the space-time continuum

Re: Word censoring [to change image file extension]

Post by warmweer »

sebo wrote: Wed Jan 24, 2024 10:30 am thanks, i know XAMPP and use it for testing, but i use it most for quite empty db.

i know that the process is faster and safer in local, but i don't even like to "bump" everytime my db to upload it online.

there are 180.000 rows in the post table, usually i prefer to do a backup and correct it online. in case of disaster i upload the backup... :?
do you suggest me to do on xampp this time? do you think the online shared server will timeout to change all the rows?
can i upload only the correction uploading only the phpbb3_post table?
Use a personal webserver for testing the procedure in the first place(the endresult).

Then you can either use the procedure online or restore the corrected table. Both will require temporary disabling of your board while the posts_table is being manipulated/uploaded.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
sebo
Registered User
Posts: 56
Joined: Mon Jan 22, 2024 10:28 pm

Re: Word censoring [to change image file extension]

Post by sebo »

just did it! it works!! thanks to all for support!!
still searching for errors, but it seems to be all ok :oops: :roll:

Return to “phpBB Discussion”