Avoid image hot-linking
What is image hot-linking
Iframely API provides you with information about thumbnail images from publishers. Image is "hot-linked" when you use the provided information as-is and put the image on your website by directly sourcing it with the URL pointing to a server of a third-party publisher. This may violate image copyright and comes with significant downsides and risks. Here’s how you can avoid broken images, respect providers, and improve your site performance.
Why hot-linking isn’t OK
- Broken images: many providers block hot-linking, leaving your site with broken images. Even if an image loads when you test the link directly, it can still fail in production due to referrer headers.
- Expired content: some images use temporary URLs with expiration signatures. Hot-linking these images will result in missing content once they expire.
- Performance risks: relying on external servers can slow your site or leave you vulnerable to throttling.
- Ethical concerns and copyright violations: using images without permission may violate image copyright and publisher terms of use. According to Iframely Terms of use, you are responsible for adhering to the terms of use of the publishers whose data you embed.
- SSL warnings: hot-linking non-secure HTTP images on an HTTPS site can trigger mixed content warnings in browsers.
What to do instead
- Download and store images on your servers or CDN. Periodically clean up unused files and refresh the data as needed. There are solutions available for this task, including open-source options like Camo proxy.
- Optimize delivery by resizing and compressing images for better performance and serve them through your own CDN.
- Use Iframely's
&refresh=true
API parameter to refresh image URLs with expiration signatures. - Consider implementing an onerror handler as a fallback. If you see a broken image, refresh API data. Add
&refresh=true
API parameter if necessary.