I want to resurface this old discussion with intent to find a way to develop a plugin which would allow upload photos by user from site UI (not admin area) into folder which corresponds to current album.
As I can see core logic resides in functions_upload.inc.php within add_uploaded_file() as $upload_dir = upload/2010/01/22/20100122003814-449ada00.jpg
Beside this being hardcoded into the function, there is really no other limitations as I can see which would prevent me to use album/subalbum/20100122003814-449ada00.jpg
Unfortunately, add_uploaded_file() call is used from few places in the code directly and there is no events in the function itself which could influence the content of $upload_dir variable and how path is formed
Potential solution would be to allow trigger after $upload_dir to allow override the content. Trigger would need to have access to $categories parameter of add_uploaded_file()
It is my understanding that everything else most likely would work without the hitch.
Thoughts?
Offline
If this gets us away from the random folder "stuff" and gets us the ability to upload into what we are having to a manage via FTP (galleries folder).. in addition to keeping the uploaded file's file name and not a pseudo-random one.. wow!
Please Serge... You'd be my life long hero!
Last edited by SnotRocket (2014-09-29 01:47:10)
Offline
yes, this is what you have described. But it does require cooperation from Piwigo team to solve unless we override upload completely
Offline
I think this has been done in purpose, to avoid what you're trying to do.
If you want to do such changes, my point of view would be to do it in core enabled via local variables. But that would need first to review if everything especially i.php would be OK for special characters, or how we strip them. That would also require to think about the ftp synch method very useful which should be merged
Offline
flop25 wrote:
I think this has been done in purpose, to avoid what you're trying to do.
If you want to do such changes, my point of view would be to do it in core enabled via local variables. But that would need first to review if everything especially i.php would be OK for special characters, or how we strip them. That would also require to think about the ftp synch method very useful which should be merged
I know it was done on purpose and there is some thought process behind it. No dispute there. However existence of FTP upload, which keeps folder structure, and web upload which does not do that, is somewhat contradictory.
I do understand that for projects like Piwigo.com it may be useful to keep "upload" folder method, but for deployments for personal use it is somewhat cumbersome.
Considering that FTP method works today, I do not see technical reasons why web upload with "FTP-like" folder structure would not work. In my humble opinion, it is just a matter to add a bit of flexibility to the core method as, for example, proposed above
This way plugin can be developed which would extend web-upload from 2.7 and add ability to keep folder structure.
As with FTP upload special characters could be handled by stripping or replacing them.
using local variables may not be very good, as it is user specific. Allowing plugin extension based on triggers may be better way to handle it as if trigger is not defined, then standard method would be used.
Thoughts?
Last edited by Serge D (2014-09-29 17:34:58)
Offline