Delete unused images

This topic contains 27 replies, has 4 voices, and was last updated by  Kiran 4 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #535840

    Kiran
    Moderator
    Post count: 7069

    I upload image.jpg and 15 extra images are created and GD is saving them for nothing.

    Those 15 images are created by WordPress uploader not by GD. GD does not has own uploader. GD just saves images with image meta(image types in serialized form) in GD attachment tables when data returned from uploader.

    1- And GD does not have them in the database even if I delete them?

    Separate image type date is saved in meta of main image. So deleting image type from folder will not delete data from meta.

    2- So I have to go to the FTP and delete 50,000 images one by one ?

    This is only possible way for now. Not sure if any third party plugin available to delete image type only.

    Kiran

    #535842

    P O
    Expired Member
    Post count: 501

    Separate image type date is saved in meta of main image. So deleting image type from folder will not delete data from meta.

    And that meta how can be deleted?

    This is only possible way for now. Not sure if any third party plugin available to delete image type only.

    Plugins work perfectly with library media, but as GD hides that, none of them work.

    Having to go manually to delete 50,000 images because GD don’t let you manage anything and hides all, is not good.

    You should implement a way to manage this, I have over 10GB of files for nothing. Stored in database and in FTP. Just because GD saves it and that’s it.

    And now I will have to spend days fixing the problem GD has.

    Thanks.

    #535848

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #536234

    P O
    Expired Member
    Post count: 501
    This reply has been marked as private.
    #536489

    Kiran
    Moderator
    Post count: 7069

    Hello,

    Try PHP snippet provided at here.

    https://gist.github.com/kprajapatii/9770fab5bdd3abc59a5dc76484335eb5

    Take backup before executing backup.

    Thanks,
    Kiran

    #536672

    P O
    Expired Member
    Post count: 501

    Hello.

    Which images will be deleted?

    image-02-36×36.jpg
    image-02-80×80.jpg
    image-02-120×120.jpg
    image-02-180×180.jpg
    image-02-260×185.jpg
    image-02-300×200.jpg
    image-02-450×300.jpg
    image-02-450×450.jpg
    image-02-495×400.jpg
    image-02-705×470.jpg
    image-02-710×375.jpg
    image-02-768×512.jpg
    image-02-845×321.jpg
    image-02-845×684.jpg
    image-02-1030×687.jpg
    image-02-1200×423.jpg
    image-02-1200×430.jpg
    image-02-1200×630.jpg
    image-02.jpg

    Will this remove it from GD and from FTP?

    This PHP works with any Enfold + GD site?

    Thank you.

    #536674

    P O
    Expired Member
    Post count: 501

    I just tried it and nothing happens. Everything exactly the same.

    All code is shown in the PHP, so something is not correct.

    Thanks.

    #536675

    P O
    Expired Member
    Post count: 501
    This reply has been marked as private.
    #536686

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #536693

    P O
    Expired Member
    Post count: 501
    This reply has been marked as private.
    #536697

    Kiran
    Moderator
    Post count: 7069

    Refer this page to check how to use PHP snippet https://wpgeodirectory.com/docs/useful-plugins/#snippets

    Kiran

    #536698

    P O
    Expired Member
    Post count: 501

    It seems it worked. Thank you!

    I now have 6 sizes instead of 15.

    Questions.

    1- Are those 6 sizes needed?
    image-02-80×80.jpg
    image-02-300×200.jpg
    image-02-768×512.jpg
    image-02-1030×687.jpg
    image-02-1200×630.jpg
    image-02.jpg

    Why not define 1 size to use and that’s it?

    2- If I disable images for upload with Simple Image Sizes plugin, I assume those will not be created next time a place is published.
    Correct?

    3- Which are the correct (best) sizes to use?
    So I can disable everything else.

    4- Can I use this in another site and everything will work the same?

    Again, thank you for your help.

    #536717

    Kiran
    Moderator
    Post count: 7069

    Hello,

    Why not define 1 size to use and that’s it?

    WordPress uses different image size to display based on purpose of display. Ex: icon, thumbnail, medium, original etc.
    To remove any image(Ex: image-02-1200×630.jpg) you first need to find which image size has generated that image. The you have to add image size name in a list in PHP snippet.

    ===

    2- If I disable images for upload with Simple Image Sizes plugin, I assume those will not be created next time a place is published.
    Correct?

    If image sizes disabled at the upload process time then it will not generate those image sizes.

    ===

    3- Which are the correct (best) sizes to use?
    So I can disable everything else.

    It depends on plugin functionality. Ex: WooCommerce, Enfold has own image sizes based own usage for customization.
    Each custom image size added by plugin or theme has some usage for it. For GD you can disable image sizes other then WordPress default.

    ===

    4- Can I use this in another site and everything will work the same?

    This snippet will work on all size where GeoDirectory is installed. But take backup first other to prevent any loosing data.

    Kiran

Viewing 13 posts - 16 through 28 (of 28 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket