Remove several images from media database at once

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
basquiat
Regular
Posts: 6
Joined: Sat Oct 07, 2006 11:45 am
Location: Mannheim, Germany
Contact:

Remove several images from media database at once

Post by basquiat »

Dear all,

as I have quite a bunch of pictures which I want to remove from my s9y media database, I wonder if there's some plugin/interface/trick that allows me to select multiple items for deletion. The current way of clicking, approving and being thrown back to the first database page afterwards is not suitable for such a task.

Best regards,
Jens
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Remove several images from media database at once

Post by Don Chambers »

Do you have FTP access? If so, you can delete them from your media folder (usually /uploads/).
=Don=
basquiat
Regular
Posts: 6
Joined: Sat Oct 07, 2006 11:45 am
Location: Mannheim, Germany
Contact:

Re: Remove several images from media database at once

Post by basquiat »

Hi DonChambers,

deleting from the filesystem itself is no problem (full SSH access to the server), but doesn't s9y also store (meta)information about the uploads in the SQL database? If so, does it clean up the data automatically after deletion (or is there some way to trigger it without manually purging any entries)?

Thank you and best regards,
Jens
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Remove several images from media database at once

Post by garvinhicking »

Hi!

Sadly currently there really is no "multi-deletion" interface. s9y actually keeps the metadata (for safety reasons, because often especially after server moves people resync their thumbnails and might loose the DB-contents).

I could write up a simple script that deletes all metadata inside the s9y table that refers to missing files, would that be a solution to your current issue?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Remove several images from media database at once

Post by Don Chambers »

Forgot about the media table. I think a utility to delete media table items that correspond to missing file system items would be good.

Garvin - would media table info be recreated for thumbnails if thumbnails (not larger images) had been deleted, then admin regenerated thumbs?
=Don=
basquiat
Regular
Posts: 6
Joined: Sat Oct 07, 2006 11:45 am
Location: Mannheim, Germany
Contact:

Re: Remove several images from media database at once

Post by basquiat »

Hi Garvin!
garvinhicking wrote:I could write up a simple script that deletes all metadata inside the s9y table that refers to missing files, would that be a solution to your current issue?
Yes, that would at least easen my problem quite some bit and would (as Don already pointed out) generally be a good thing to have, maybe integrated into the admin interface one day?

Thank you and best regards,
Jens
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Remove several images from media database at once

Post by garvinhicking »

Hi!

Argl. I'm with stupid. I just went about to add this to the core and was halfway through, when I found out Serendipity in fact already DOES delete image references in the database, when a file is no longer existing. :-)

So, go ahead and delete your files, and then simply use the "sync thumbnailS" option in the s9y admin interface. You might want to to a full backup of the filesystem and database prior to this. ;)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Remove several images from media database at once

Post by Don Chambers »

garvinhicking wrote:Argl. I'm with stupid.
:lol: :lol: :lol:

Been there, done that, bought the t-shirt! :mrgreen:
=Don=
basquiat
Regular
Posts: 6
Joined: Sat Oct 07, 2006 11:45 am
Location: Mannheim, Germany
Contact:

Re: Remove several images from media database at once

Post by basquiat »

garvinhicking wrote:I just went about to add this to the core and was halfway through, when I found out Serendipity in fact already DOES delete image references in the database, when a file is no longer existing. :-)
Glad to see s9y has even so far evolved that it's core developers can't keep up. ;-) As I followed your suggested steps, I now have a "legacy free" media database again.

Thanks to both of you, Garvin and Don, for the time you took on this! ;-)

Best regards,
Jens
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Remove several images from media database at once

Post by Don Chambers »

Glad it worked Jens.

Hey Garvin, I think I found our t-shirt on Amazon!!! :lol: :mrgreen: :lol: :mrgreen: :lol:
Image
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Remove several images from media database at once

Post by garvinhicking »

Hi Don!

Great shirt, but I believe it needs the arrow pointing upwards. :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Remove several images from media database at once

Post by Don Chambers »

garvinhicking wrote:Hi Don!

Great shirt, but I believe it needs the arrow pointing upwards. :-)

Regards,
Garvin
Good point! :lol: :lol:
=Don=
Post Reply