Just another WordPress site

Detect duplicate image

Hi folks, today in this tutorials I am going to show you how anyone can easily detect duplicate image inside the page and remove one of them. I am writing this tutorial because recently I have been working in a inbuilt wordpress project where the content and images was already loaded. My job was to create a new theme with existing content. When I import those content in the new theme I found that in all post there were same image repeating. One is coming from feature image and another one was hard coded inside the page. Both the image was coming form the same path. With trying with some simple jQuery script I was able to accomplished this job.

This is how I detect duplicate image with the help of jQuery.

Detect duplicate image with jQuery

    var srcs = [],
    $("body img").filter(function(){
        temp = $(this).attr("src");
        if($.inArray(temp, srcs) 

I hope you find this tutorial helpful. Thanks for reading.

The post Detect duplicate image appeared first on Santosh Shah.

Leave a Reply

Your email address will not be published. Required fields are marked *