Is there any way to prune broken image links?

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

  • placeholder.webp
    placeholder.webp
    18.8 KB · Views: 10
Back
Top Bottom