Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a couple news sites set up and they use Feeds, as well as Feeds image grabber. Due to the volume, I have the news items imported automatically delete after 10 days. It would be ideal to my server's stability & overall well-being (it's temperamental sometimes) if the images were to go away along with the imported feed, rather than have old images just stay there indefinitely.
Is this something already there that I missed, or is this something I have to set up myself?
Comments
Comment #1
brks CreditAttribution: brks commentedAccording to my experience, when the feed item(node) is deleted manually, the one image in the feed item(node) will be deleted as well.
However, if the original article has more than one images, say 5 of them, the module will download all 5. Only 1 appears in the node, the other 4 are in the file folder as well. When you delete the node, only 1 image deleted along with the node, and the other 4 remains. Furthermore, the information of the 4 nodes are still in your data base. You can manually delete the 4 images and the information in database; but since you have a lot of images to handle at the same time, it is not so easy to filter out the 4 images and the information in the database. I still wonder if this can be solved through configuration, or it is an issue of the module.
Comment #2
rooby CreditAttribution: rooby commentedSounds like that is a bug that could have its own issue.
Comment #3
rooby CreditAttribution: rooby commented@skyline5k:
Is that what you are experiencing or are you only dealing with a single image and it is not being deleted?
If it is only a single image then it is a feeds problem (I assume feeds is what you are using to remove the nodes after 10 days, if not it is whatever module is doing the deletions), because as brks says, if a node is properly deleted its images will also be deleted.
Unless of course that image is used on other nodes within that 10 days, in which case the image will remain for its other node(s).
Comment #4
rooby CreditAttribution: rooby commentedFor the one image bug see #1366390: Only the last image collected is ever imported
Comment #5
brks CreditAttribution: brks commented@rooby, thank you so much for the solutions!
I will let you know once I use the patches.
Comment #6
brks CreditAttribution: brks commentedI've edited the feeds image grabber according to patch mentioned above (as @rooby mentioned in the link he quoted above, just put
$image_count++;
at the right place), and now it could grabber all the images.If the feed item (node) is deleted, the images in it are all deleted from the server and the database is cleared accordingly. This is great!
@rooby, thank you again.