Home › WordPress Company › Syndic Tools › Y30 Media in FeedWP › PRIV Y33 Duplicated Images
PRIV Y33 Duplicated Images
Page no: Y33
Old Version
We are focused on the post.
We can only delete attached images.
But if we delete we lose important information, because the same image can still appear unattached many times.
|
|
New Version
Move focus to image and where it occurs.
Typical Case:
- Attached multiple times to one post
- Not Attached to other posts
- Many times unattached
|
|
We must remove duplicated images, because it makes our DB slow.
There we need a syndication tools function that does this.
Candidates for Removal
All candidates have the same file name. Necessary condition for all below.
Case 1) Both files are attached to same post.
We do not check yet if the file is used inside the post!
The syndication tool should print the post name, date (similar to other syndication tools) and the files names and URL.
|
|
Detailed Requirements
problem Case
We have
- an image (identified by imageName like “kerviel-2.png”) and
- multiple image occurrences of this image in wp-content
like /wp-content/uploads/2016/10/kerviel-2.png
and /wp-content/uploads/2016/09/kerviel-2.png
and …
- But only one image occurrence should be kept, that one that is used in the post. The others should be deleted.
|
Solution Proposal
SQL 1:
For all posts selected (as in syndication tools)
Find all image file names in SRC based on HTML
Find all attached images to the post
1) Delete all images, which are attached, but not used in the content.
SQL2:
Find other posts, the which this image (or Image Name) is attached.
SQL3:
Find out how many times, this image (or Image Name) is unattached. |
Functions:
- Delete Attached but not used
- Delete Unattached
- Delete Attached and Unattached
Implementation
Write here the 3 SQL and the HTML syntax. |
|
Bugs
Duplicated unattached Images are not found.
EconomicBlogs.ch, Never mind the markets
|
Syndication Tools: No Unattached Images Found ,
|
Test
Results after run Remove Duplicate Images Function. |
. |
See more for sYndication Tools