#1 2014-09-28 06:07:36

Serge D
Member
US
2014-07-15
385

Community Plugin, Piwigo Upload function and upload folder

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

 

#2 2014-09-29 01:45:49

SnotRocket
Member
2014-08-15
63

Re: Community Plugin, Piwigo Upload function and upload folder

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

 

#3 2014-09-29 03:41:37

Serge D
Member
US
2014-07-15
385

Re: Community Plugin, Piwigo Upload function and upload folder

yes, this is what you have described. But it does require cooperation from Piwigo team to solve unless we override upload completely

Offline

 

#4 2014-09-29 08:10:06

flop25
Piwigo Team
2006-07-06
7038

Re: Community Plugin, Piwigo Upload function and upload folder

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


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#5 2014-09-29 17:34:21

Serge D
Member
US
2014-07-15
385

Re: Community Plugin, Piwigo Upload function and upload folder

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

 

Board footer

Powered by FluxBB