Changing thumbnail naming convention Changing thumbnail naming convention
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Changing thumbnail naming convention

Started by tuxhedoh, November 10, 2003, 07:45:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tuxhedoh

I know that it's possible  to change  the prefix for thumbnails, but is it possible to have a suffix instead of a prefix.... i'm currently using Slooze, and it knows it's thumbnails by filename-t.jpg and I've already got a ton of pictures named that way.... does anyone  have any ideas.  I've got shell access to my host, so if anyone knows an easy way to rename a ton of pictures from filename-t.jpg to thumb_filename.jpg without much hassle I'd be more than interested... especially if that will be easier than modifing the coppermine code.

**[size=9]I realize this  is in the wrong forum... sorry. A mod feel free to move it.[/size]

Joachim Müller

I don't have a script ready to copy'n paste, but I'd have a look at the searchnew.php that comes with coppermine: it's normally used to go through all subfolders of the album folder to "hunt" for files that aren't in the database already (batch-add function); it should be fairly easy to modify it to run through the folders renaming files that match to a regex expression, of even easier: delete all thumbs instead of renaming them and let the utility "util.php" ("resize pictures" in the admin menu) batch-create all thumbs anew.

GauGau

libelle

Quote from: "tuxhedoh"I know that it's possible  to change  the prefix for thumbnails, but is it possible to have a suffix instead of a prefix.... i'm currently using Slooze, and it knows it's thumbnails by filename-t.jpg and I've already got a ton of pictures named that way.... does anyone  have any ideas.  I've got shell access to my host, so if anyone knows an easy way to rename a ton of pictures from filename-t.jpg to thumb_filename.jpg without much hassle I'd be more than interested... especially if that will be easier than modifing the coppermine code.

**[size=9]I realize this  is in the wrong forum... sorry. A mod feel free to move it.[/size]

Well, the Unix shell has Mighty Power. If your shell is bash (which most Linux systems default to), you can do the following:


for i in filespec*.jpg; do mv $i thumb_${i/-t/}; done


If your shell is cshell, tcshell, kshell, zshell, or one of the many others, you should be able to temporarily switch over to bash by typing
/bin/bash
Then use the commands listed above.

WARNING: Renaming files can delete them in Unix if they clobber each other's names! A typo in the above command could be disastrous!  I have tested this on my own machine, but if your version of bash is different, it may behave differently! Back up your directory before using this command! I take no responsibility for lost files!

Good luck!
--
SjG

libelle

In the above example, make sure to replace "filespec*.jpg" in the code with something that will actually match your filenames.

For example, if you're renaming from "picture0000-t.jpg" to "thumb_picture0000.jpg" use "picture*.jpg"

If this is confusing, let me know and I can clarify further.
--
SjG

Oasis

Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org