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
Uploading from IOS on _ _
- Jan
- Phoca Hero

- Posts: 49144
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Uploading from IOS on _ _
Hi, yes, the only way (except fixing IOS) is to customize it - to set new name for the uploaded image. But unfortunately I am not user of IOS so cannot test it and somehow add such features, so for now I really don't have any clue advice how to change it 
Jan
Jan
If you find Phoca extensions useful, please support the project
-
touraku
- Phoca Newbie

- Posts: 4
- Joined: 12 Apr 2015, 01:16
Re: Uploading from IOS on _ _
Hello Jan
Thanks for your reply, and also for Phoca Gallery, it's great! I appreciate you must be very busy, so thanks for taking the time to reply.
IOS cant be changed, some paid apps can change picture file names but the uploader always uses the IOS default which is image.jpg
If you can tell me which PHP file to try (files have changed since the previous post was made), I can experiment with script such as this found on stackoverflow:
if(file_exists('../../images/students/'.$name)){
$i = 1;
while(file_exists('../../images/students/'.$i."_".$name)){
$i++;
}
$name = $i."_".$name;
}
and see if it will work?
Would be good to fix, as a lot of my students use IOS and have complained that they can't upload.
mokuhanga-school.com.au/index.php/gallery/category/3-student-s-works
Thanks
Terry
Thanks for your reply, and also for Phoca Gallery, it's great! I appreciate you must be very busy, so thanks for taking the time to reply.
IOS cant be changed, some paid apps can change picture file names but the uploader always uses the IOS default which is image.jpg
If you can tell me which PHP file to try (files have changed since the previous post was made), I can experiment with script such as this found on stackoverflow:
if(file_exists('../../images/students/'.$name)){
$i = 1;
while(file_exists('../../images/students/'.$i."_".$name)){
$i++;
}
$name = $i."_".$name;
}
and see if it will work?
Would be good to fix, as a lot of my students use IOS and have complained that they can't upload.
mokuhanga-school.com.au/index.php/gallery/category/3-student-s-works
Thanks
Terry
- Jan
- Phoca Hero

- Posts: 49144
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Uploading from IOS on _ _
Hi,
"Would be good to fix, as a lot of my students use IOS and have complained that they can't upload."
Yes, did somehow contact IOS developers so they will fix it?
The problem of uploading images is, it is not set only in one file, it is complete MVC structure stored in more files - so the files need to be detected by the called functions and classes:
Frotend:
1) the upload is in components/com_phocagallery/views/user/tmpl/ ...
2) then it goes to controller: components/com_phocagallery/controllers/user.php
3) from controller it goes to module: components/com_phocagallery/modules/user.php
Then here the upload classes are called: administrator/components/com_phocagallery/libraries/phocagallery/file
Jan
"Would be good to fix, as a lot of my students use IOS and have complained that they can't upload."
Yes, did somehow contact IOS developers so they will fix it?
The problem of uploading images is, it is not set only in one file, it is complete MVC structure stored in more files - so the files need to be detected by the called functions and classes:
Frotend:
1) the upload is in components/com_phocagallery/views/user/tmpl/ ...
2) then it goes to controller: components/com_phocagallery/controllers/user.php
3) from controller it goes to module: components/com_phocagallery/modules/user.php
Then here the upload classes are called: administrator/components/com_phocagallery/libraries/phocagallery/file
Jan
If you find Phoca extensions useful, please support the project