upload with IOS

Phoca Gallery - image gallery extension
ptitcoeur59
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 02 Jul 2015, 19:34

upload with IOS

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

Re: upload with IOS

Post 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
If you find Phoca extensions useful, please support the project
Post Reply