1. 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

Discussion in 'XenForo Questions and Support' started by Brentnauer, Sep 12, 2014.

  1. Brentnauer

    Brentnauer Well-Known Member

    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?
     
  2. Brentnauer

    Brentnauer Well-Known Member

    To clarify, the initial /ttiforum/images/graemlins/smile.gif was not surrounded in img tags; they were simple plain text.
     
  3. Mike

    Mike XenForo Developer Staff Member

    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.
     
  4. Brentnauer

    Brentnauer Well-Known Member

    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?
     
  5. Brentnauer

    Brentnauer Well-Known Member

    I also have the image proxy option enabled, if that makes a difference.
     
  6. Brentnauer

    Brentnauer Well-Known Member

    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.
     
  7. Mike

    Mike XenForo Developer Staff Member

    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.)
     
  8. Brentnauer

    Brentnauer Well-Known Member

    I figured it out. User error... I was running the queries on the wrong database.

    Doh.
     

Share This Page