SQL and Bulk Deleting Images from Listings

This topic contains 8 replies, has 2 voices, and was last updated by  jltrinka 9 years, 10 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #9373

    jltrinka
    Free User
    Post count: 183

    I am in a position where I need to bulk delete all images of the same name from a couple hundred gd_place listings. I plan to do this in SQL with an update statement.

    All of the links to the images were imported in bulk from a CSV file linking to a single image on our server in the /uploaded/ folder, but when someone claims a listing and deletes this image from their listing, it removes the file from the server, leaving an errored image in its place in all listing profiles.

    What table and row would I need to change in order to delete the IMAGE1 image for multiple listings? Is there any other recommended way to bulk delete images from listings?

    #9395

    Simone
    Expired Member
    Post count: 3515

    I believe it’s not so easy.
    You should see what ID is the post/place and then match it in the geodir_attachments table, from there you’ll see the images, and the one with “1” as “menu_order” is the one you need to delete.

    I’ll notify Vikas about that, maybe he’ll knows a better and easy way to do that.

    #9397

    jltrinka
    Free User
    Post count: 183

    If “/2014/06/default_shops.jpg” is the name of the image i want to bulk remove, couldn’t i do something like this then?

    
    
    select * from geodir_attachments where file = "/2014/06/default_shops.jpg"
    
    UPDATE geodir_attachments
    SET file = REPLACE(file, '/2014/06/default_shops.jpg', '/2014/06/')
    
    UPDATE geodir_attachments
    SET mine_type = REPLACE(mime_type, 'image/jpeg', '')
    
    UPDATE geodir_attachments
    SET mime_type = REPLACE(mime_type, 'image/jpeg', '')
    
    UPDATE geodir_attachments
    SET title = REPLACE(title, 'default_shops', NULL)
    
    #9399

    Simone
    Expired Member
    Post count: 3515

    I guess something of this will work but…this isn’t bulk 🙂 this is manual since you have to manually change the file name for each place

    #9405

    jltrinka
    Free User
    Post count: 183

    im not sure i follow, wouldnt these queries recursively clear out the entries?

    #9406

    Simone
    Expired Member
    Post count: 3515

    I tried to update only the attachment table and it works. What I meant is that you need to do that file by file not “bulk”

    #9411

    jltrinka
    Free User
    Post count: 183

    Well, there is only one image file that I am trying to remove from many listings.

    #9412

    Simone
    Expired Member
    Post count: 3515

    Oh sorry I thought you had multiple listings with different images, you’re good to go then

    #9683

    jltrinka
    Free User
    Post count: 183

    Okay, so I made a post earlier today about an issue I think is related to this:

    https://wpgeodirectory.com/support/topic/default-listing-image-not-displaying/

    I think the images are linked somewhere else in SQL making GD think there are still images and not show the default image set in the Place Categories section. I really desperately need to find a solution to this. Can you guys please help with this?

Viewing 9 posts - 1 through 9 (of 9 total)

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

Open Support Ticket