Page 1 of 1

upload with IOS

Posted: 02 Jul 2015, 19:43
by ptitcoeur59
Hello,


I am confronted, like several among us, with the problem of the upload of image from the _ _ and _ _ (IOS).
All the images have the name “image.jpg”
So it would be possible to modify the noun of the image stole it, while adding, for example, the date and the hour, and possibly, a random number to avoid having 2 files with an identical name.
I am conscious that you find that it has Apple to make this modification, but it is simpler of modifies phoca Gallery than IOS!

The other solution is to migrate on another System of gallery photo, but I like the simplicity of phoca…

In advance Thank you

Re: upload with IOS

Posted: 04 Jul 2015, 13:40
by Jan
Hi, unfortunately I don't have any experiences with ios so cannot test it.

Not sure but maybe here in the forum was some guide for this (maybe for Phoca Download) so the file name will be changed to other name:

Try to modify this file:

administrator\components\com_phocagallery\libraries\phocagallery\file\fileupload.php
(cca line 49 for multiple upload)
(cca line 343 for single upload)

FROM:

Code: Select all

if (isset($file['name'])) {
   $file['name']	= JFile::makeSafe($file['name']);
}
TO:

Code: Select all

if (isset($file['name'])) {
   $dateNow	= getdate();
   $file['name']   = $dateNow[0] . '.jpg';
   $file['name']	= JFile::makeSafe($file['name']);
}
I didn't test so it needs to be tested. And this customization works for JPG only, if you are uploading other formats (e.g. PNG) you need to add some if condition - to detect the filetype - if jpg or png and then rename it with correct filetype - or you can just change "image" to date with str_replace, etc. - there are more possible ways to do it.

Jan