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

Is there any way to prune broken image links?

Discussion in 'Forum Management' started by Amin Sabet, Dec 18, 2015.

  1. Amin Sabet

    Amin Sabet Well-Known Member

    My sites have tons of old, broken image links. Images that were embedded using IMG tags but reference old image URLs that no longer exist on Flickr, etc. Is there any way to prune those without doing them one by one, manually?
     
  2. wang

    wang Well-Known Member

    A way of doing that would be to run a sql query. You can try something like this.

    Code:
    UPDATE xf_post SET message = REPLACE(message, 'flickers_urls', '');
    What this query does, is that it will find all url posted by flickers and then replace them with blank space. It would be the same like deleting them. And of course, replace flickers_urls with the actual urls. And please take a backup before running the query. Because once you will run it, it can not be undone.
     
  3. Nuno

    Nuno Active Member

    Hi,

    What I've done in my community was replace broken images with a placeholder:

    Code:
    <script>
        $("img.bbCodeImage").one('error', function() {
            $(this).attr("src", "/styles/default/placeholder.jpg");
        }).each(function() {
            if (this.complete && !this.naturalHeight && !this.naturalWidth) {
                $(this).triggerHandler('error');
            }
        });
    </script>
    Just add this code before /body
     

    Attached Files:

    maszd, RoldanLT and Amin Sabet like this.

Share This Page