coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Fab on September 04, 2006, 11:13:35 AM

Title: Is it possible to edit pictures titles and descriptions in batch?
Post by: Fab on September 04, 2006, 11:13:35 AM
I have to add titles and descritions to close to a thousand pictures, a lot of them will have the same title and description.

Is it possible to edit the pictures titles and descriptions in batch? maybe with a plugin or straight from a file.
Title: Re: Is it possible to edit pictures titles and descriptions in batch?
Post by: ralfs on September 04, 2006, 03:31:23 PM
Hi.

In your case I would go the direct way:
Run phpmyadmin, take your database.
Then 'SQL' and enter

Update cpg_pictures
  SET title = x
  WHERE aid = y

Regards,
Ralf
Title: Re: Is it possible to edit pictures titles and descriptions in batch?
Post by: Fab on September 04, 2006, 07:50:03 PM
Thanks Ralf, but I need some clarification.

Let say I want to set title to "RED" for  pictures named redpic001 to redpic150

What should I type?

And can I use the same method for keywords?
Title: Re: Is it possible to edit pictures titles and descriptions in batch?
Post by: ralfs on September 04, 2006, 11:50:34 PM
Hmm,

Ok, there might be special SQL terms where these things could be done, but I don't know much more than the 'standard command calls' in SQL.
You could try regular expressions in your SQL query:

Update cpg_pictures
  SET title = 'x'
  WHERE filename REGEXP 'xyz'

Without trying it, I think, in your special case REGEXP '^redpic[0-1][0-5][0-9]' would output 'redpic000.jpg' to 'redpic159.jpg'
So you could have a deeper look into SQL syntax, regular expressions & co. or you try something totally different:

Create a new temporary album. Move all pictures, which have something in common such as title, to that album. After batch update via SQL, as I described in my first answer, you can move them back where they came from.

It doesn't matter, what you do: you have to address exactly these files, you want to change. Be it via a special REGEXP in an SQL call or be it by placing all relevant pictures in a temporary album (where aid = xyz).

And: Of course, you can use any field in your table, also the keywords field:
Update cpg_pictures
   SET title = 'x'
   WHERE keywords REGEXP 'xyz'

Regards,
Ralf

Title: Re: Is it possible to edit pictures titles and descriptions in batch?
Post by: Joachim Müller on September 05, 2006, 03:18:00 AM
Be extra carefull when messing with the database in phpMyAdmin. Make sure to backup everything before trying, as  there's a great danger of ruining your entire site running a query that gies wrong.
Title: Re: Is it possible to edit pictures titles and descriptions in batch?
Post by: Fab on September 05, 2006, 05:18:59 AM
Quote from: GauGau on September 05, 2006, 03:18:00 AM
Be extra carefull when messing with the database in phpMyAdmin. Make sure to backup everything before trying, as  there's a great danger of ruining your entire site running a query that gies wrong.

Yes I know, I think I will install another gallery to experiment.

Before I try this are there any other alternatives to batch edit titles?