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

Add-on Broken Images Replacement

Discussion in 'Resource and Add-on Requests' started by DRE, Sep 6, 2013.

  1. DRE

    DRE Well-Known Member

    Can someone create an addon that removes broke images and just replaces them with the url (but not as an embedded link)? Got this idea from a post in the MetaMirror thread by @HWS
     
  2. Daniel Hood

    Daniel Hood Well-Known Member

    To do that you would pretty much have to CURL the url of the images and check the response codes which could significantly slow down your page load (not to mention eat up your bandwidth).

    Not saying it can't be done, just saying I'm not sure it'll be worth it.

    Maybe instead you could check them on each post submit/edit. Doesn't do much for your existing posts though.
     
  3. DRE

    DRE Well-Known Member

    It's basically just something I wanted to run one time then disable since I have a lot of existing broken images.
     
  4. DRE

    DRE Well-Known Member

    I'm using nowhere near my bandwidth limit anyway plus I'm using a CDN.
     
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

  6. DRE

    DRE Well-Known Member

    Last edited: Sep 6, 2013
    Matthew Hawley likes this.
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    An onerror attribute applied to the <img will easily accomplish what you want. I have a guide laying around here that lays out most of the work.
     
  8. DRE

    DRE Well-Known Member

    Okay so I googled onerror and the defintion is "a onerror event is triggered if an error occurs while loading an external file (e.g. a document or an image)". Execute a JavaScript if an error occurs when loading an image. That sounds like something for new posts. What I need is an addon that would do it for existing posts.
     
  9. Jeremy

    Jeremy XenForo Moderator Staff Member

    It has nothing to do with when a post is made. HTML is date independent. It'll occur if an error is received from where ever the image is hosted.
     
  10. AndyB

    AndyB Well-Known Member

    What benefit is there in doing this?
     
  11. DRE

    DRE Well-Known Member

    Look at this screenshot. See all the broken image links? I would like an addon to strip this and replace them with non-embedded links or thumbnail that says this image is no longer available.

    Screen Shot 2013-09-06 at 6.56.14 PM.png
     
  12. AndyB

    AndyB Well-Known Member

    The only benefit I can see in replacing broken images with a working image (one that indicates image no longer available) is for SEO purposes. Is this the benefit you are seeking DRE?
     
  13. DRE

    DRE Well-Known Member

    That and lets say for instance I want to edit an existing post and delete the broken images. I can't see them unless I disable the Rich Text Editor.

    Also, lets say that post with the broken image is hosted by a site that is no longer up. I can then go to phpmyadmin and do a SQL search for that site's domain and find all the posts hosted under that domain and from there I can delete the links and just replace them with a working image or just remove it period. I'm not sure what the exact search string to do that is but I know it can be done.
     
  14. AndyB

    AndyB Well-Known Member

    Sounds like you would like to fix posts that contain broken images. Perhaps a better option would be to create a script that would create a list for you that has links to all posts which contain broken images. The script could be run any time and you can fix the broken images over time until they are all fixed.
     
    DRE likes this.
  15. DRE

    DRE Well-Known Member

    That could work.
     
  16. DRE

    DRE Well-Known Member

    AndyB likes this.

Share This Page