Auto renaming with batch upload

pjdevries
Phoca Member
Phoca Member
Posts: 18
Joined: 06 Feb 2008, 09:44
Location: Netherlands

A nice feature might

Post by pjdevries »

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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

I think will be not

Post by Jan »

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
pjdevries
Phoca Member
Phoca Member
Posts: 18
Joined: 06 Feb 2008, 09:44
Location: Netherlands

Can you give a few p

Post by pjdevries »

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.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

it starts with store

Post by Jan »

it starts with store function:
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
erioch
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 19 Sep 2011, 12:19

Re: Auto renaming with batch upload

Post by erioch »

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;
}
}
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Auto renaming with batch upload

Post by Jan »

Hi, thank you for the info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply