• 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

Daniel Hood

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

DRE

Well-known member
#3
It's basically just something I wanted to run one time then disable since I have a lot of existing broken images.
 

DRE

Well-known member
#4
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).
I'm using nowhere near my bandwidth limit anyway plus I'm using a CDN.
 

Jeremy

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

DRE

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

Jeremy

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

DRE

Well-known member
#11
What benefit is there in doing this?
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
 

AndyB

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

DRE

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

AndyB

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

Well-known member
#15
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.
That could work.