forum.coppermine-gallery.net

No Support => General discussion (no support!) => Topic started by: tuxhedoh on November 10, 2003, 07:45:17 pm

Title: Changing thumbnail naming convention
Post by: tuxhedoh on November 10, 2003, 07:45:17 pm
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]
Title: Changing thumbnail naming convention
Post by: Joachim Müller on November 10, 2003, 09:00:11 pm
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
Title: Re: Changing thumbnail naming convention
Post by: libelle on November 12, 2003, 07:30:41 am
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:

Code: [Select]

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
Code: [Select]
/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!
Title: Re: Changing thumbnail naming convention
Post by: libelle on November 12, 2003, 07:33:20 am
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.
Title: Changing thumbnail naming convention
Post by: Oasis on November 15, 2003, 09:33:44 am
POST DELETED..