Auto renaming with batch upload
-
- Phoca Member
- Posts: 18
- Joined: 06 Feb 2008, 09:44
- Location: Netherlands
A nice feature might
A nice feature might be an automatic rename function when uploading multiple images. I am thinking of regular expressions that translates directory and file names into user friendly category and gallery image names. Can't be that hard to implement I think
- Jan
- Phoca Hero
- Posts: 48416
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
I think will be not
I think will be not to hard, but it will be hard to find time for it
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 18
- Joined: 06 Feb 2008, 09:44
- Location: Netherlands
Can you give a few p
Can you give a few pointers where to look for? I'm quite occupied myself so I can't make any pro misses, but if I know where to look and it's not too complicated, I'll try to squeeze in a couple of minutes to see if I can implement it.
- Jan
- Phoca Hero
- Posts: 48416
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
it starts with store
it starts with store function:
administrator\components\com_phocagallery\models\phocagallerym.php
hepers you find here:
administrator\components\com_phocagallery\helpers\phocagallery.php
administrator\components\com_phocagallery\models\phocagallerym.php
hepers you find here:
administrator\components\com_phocagallery\helpers\phocagallery.php
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 6
- Joined: 19 Sep 2011, 12:19
Re: Auto renaming with batch upload
Hi,
I was able to hack the file in administrator\components\com_phocagallery\models\phocagallery.php to generate a random ID whenever the title is missing instead of picking the file name... Below is the hack approximately line 112 to 126...
Cheers
//If there is no title and no alias, use filename as title and alias
if ($data['title'] == '') {
//$random_number = rand (5,10000000) ;
$error = 1;
// this while clause will loop until it has a unique number
while ($error) {
$num = rand(0, 10000000);
if (mysql_num_rows(mysql_query("SELECT * FROM jos_phocagallery WHERE jos_phocagallery=$title")) != 0)
$error = 1;
else
$error = 0;
}
$data['title'] = 'image ID_00'.$num;
}
}
I was able to hack the file in administrator\components\com_phocagallery\models\phocagallery.php to generate a random ID whenever the title is missing instead of picking the file name... Below is the hack approximately line 112 to 126...
Cheers
//If there is no title and no alias, use filename as title and alias
if ($data['title'] == '') {
//$random_number = rand (5,10000000) ;
$error = 1;
// this while clause will loop until it has a unique number
while ($error) {
$num = rand(0, 10000000);
if (mysql_num_rows(mysql_query("SELECT * FROM jos_phocagallery WHERE jos_phocagallery=$title")) != 0)
$error = 1;
else
$error = 0;
}
$data['title'] = 'image ID_00'.$num;
}
}
- Jan
- Phoca Hero
- Posts: 48416
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Auto renaming with batch upload
Hi, thank you for the info.
Jan
Jan
If you find Phoca extensions useful, please support the project