• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Query to replace content creates broken images

Brentnauer

Well-known member
#1
Hi there,

I'm trying to run some queries to fix old smiley code in my posts. Example:

Code:
UPDATE xf_post SET message = REPLACE(message, '/ttiforum/images/graemlins/smile.gif', ':)')
However, when I go look at my posts after running a few of these, all of my smilies look like this:
Code:
[IMG]http://:)[/IMG]
Obviously they're broken.

Running a query to replace the smiley inside of the img BBcode shows that 0 rows were affected.

Any ideas?
 

Mike

XenForo developer
Staff member
#3
The query as given couldn't cause that explicit text there unless it was already there. It would mean that this was there:

Code:
[IMG]http:///ttiforum/images/graemlins/smile.gif[/IMG]
Which certainly isn't impossible -- I've seen relative URLs be translated like that before (not in XF).

You may need to write additional replacement queries.
 

Brentnauer

Well-known member
#4
The query as given couldn't cause that explicit text there unless it was already there. It would mean that this was there:

Code:
[IMG]http:///ttiforum/images/graemlins/smile.gif[/IMG]
Which certainly isn't impossible -- I've seen relative URLs be translated like that before (not in XF).

You may need to write additional replacement queries.
Hi Mike,

I tried this:
Code:
UPDATE xf_post SET message = REPLACE(message, '[IMG]:)[/IMG]', ':)')
...But the query reported that it affected 0 rows. Is there something else I can try?
 

Brentnauer

Well-known member
#6
I can for-sure confirm that the string I initially tried to replace was NOT surrounded by IMG tags; I just looked at the backup I made prior to messing around and there's nothing there.

I have a feeling it's related to the image proxy thing (since it's showing the broken image icon that the proxy uses). Not sure how to fix it though.
 

Mike

XenForo developer
Staff member
#7
Can you provide a link to demonstrate?

Also, disable the rich text editor in your preferences and then go to edit the post. What exactly do you see? (That is what is in the post; if you leave the RTE enabled, you may see a modified version which the query listed probably won't match.)