Hi,
anyone know if it possible to batch renaming the images when create a new album?
I.e.
Anyone can help me to do this?
Why don't you do the batch rename process before you upload them? http://www.freedownloadscenter.com/Utilities/File_Cleanup_Utilities/Batch_File_Renamer.html
I want this feature to skip the process with a 3rd party application.
Now I'm working on a pclzip function to do that.
I've done!
With this hack when a user create a new album and upload a zip all the images of the zip will be renamed in this way:
{folder_name}-{xxx}.{extension}
where xxx is a progressive number (i.e. 001, 002,etc)
Then if i create a new album called "My new album" the images will be renamed as:
my-new-album-001.jpg
my-new-album-002.jpg
my-new-album-003.jpg
my-new-album-004.jpg
and so on.
If anyone is interested:
// Use Zlib
require_once('pclzip.lib.php');
$zip = new PclZip($file);
if ($zip->extract(PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_REMOVE_ALL_PATH) == 0) {
die("Error : ".$zip->errorInfo(true));
}
// Begin batch-renaming hack
$batch_name = $_POST['folder'];
$ls = glob($dir."/*");
$n = 1;
foreach ($ls as $image_tmp_name) {
$nn = str_pad($n,3,'0',STR_PAD_LEFT);
$file_temp1 = explode($dir,$image_tmp_name);
$file_temp2 = explode('.',$file_temp1[1]);
$file_ext = $file_temp2[1];