Uploading from IOS on _ _
Posted: 12 Apr 2015, 02:40
Hello,
Cannot upload a photo from _ _ into Phoca Gallery.
This is a problem with IOS itself - when selecting a photo from the camera roll, it is automatically named "image.jpg" this then causes an error message after trying to upload in Phoca Gallery from the front end.
I notice Kunena forum works / overcomes this same problem by automatically re-naming the image from "image.jpg".
I found this post:
viewtopic.php?f=11&t=751
Does anyone know a work around?
Could the script in this post be adapted to rename the file on upload? (script is copied below)
If so, can anyone help me with this script?
Thanks Terry
From the above post:
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...
//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;
}
}
erioch
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 19 Sep 2011, 12:19
from post:
viewtopic.php?f=11&t=751
Cannot upload a photo from _ _ into Phoca Gallery.
This is a problem with IOS itself - when selecting a photo from the camera roll, it is automatically named "image.jpg" this then causes an error message after trying to upload in Phoca Gallery from the front end.
I notice Kunena forum works / overcomes this same problem by automatically re-naming the image from "image.jpg".
I found this post:
viewtopic.php?f=11&t=751
Does anyone know a work around?
Could the script in this post be adapted to rename the file on upload? (script is copied below)
If so, can anyone help me with this script?
Thanks Terry
From the above post:
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...
//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;
}
}
erioch
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 19 Sep 2011, 12:19
from post:
viewtopic.php?f=11&t=751