• 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?

Amin Sabet

Well-known member
#1
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?
 

wang

Well-known member
#2
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.
 

Nuno

Active member
#3
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
 

Attachments