forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: eadamuk on December 31, 2012, 01:43:22 am

Title: Plugin that monitors a directory for uploads and automatically adds to gallery
Post by: eadamuk on December 31, 2012, 01:43:22 am
I'm looking for a plugin that can monitor a directory which I'm going to FTP images too periodically. I'd like coppermine to watch for new photos and add them to a gallery automatically. I'm reading it can be done, but i can't find out how.

Thanks,
Adam
Title: Re: Plugin that monitors a directory for uploads and automatically adds to gallery
Post by: Αndré on January 02, 2013, 02:21:26 pm
As far as I know such a plugin doesn't exist yet. Additionally, I won't create it for you (lack of time).

Some suggestions:

To make it run automatically you have to use a cronjob (either create it on your server or use a third-party cronjob provider). Of course you could also check for new images on page loads by a visitor, but that's not recommended, as the page load time increases for that user and if anything goes wrong, the user will probably see some error messages.

I don't think that you need to create a genuine Coppermine plugin. Just create a new PHP file, add it to the gallery root, include include/init.inc.php and add some simple code that reads a certain directory for new files. The script should be accessible publicly (without login to Coppermine), so "everybody" can start the process. I suggest to move new files to a different directory before adding it to the gallery, so the monitor script don't consumes too much resources if the monitor directory grows. Additionally you have to ensure that the file has been transferred completed to the gallery before you add it to the gallery (maybe check the files' modification times or store their file sizes somewhere and compare it e.g. every 15 minutes if they has changed).
Title: Re: Plugin that monitors a directory for uploads and automatically adds to gallery
Post by: theramius on February 11, 2013, 08:16:04 am
or just recognize new uploads in a folder structure (including subfolders) (of course with the before mentioned cron job)
thus creating category and albums
AND
wait for a last file / process file to start the picture adding
(like wait for the file z.txt, if present wait 1 minute or 2 (thus ftp uploads of bigger files have time to finish while the zzz file was already uploaded)

i also wish to have such a plugin!!! :-D
would be perfect for multi uploader sites

thx

best regards,
stefan
Title: Re: Plugin that monitors a directory for uploads and automatically adds to gallery
Post by: theramius on February 12, 2013, 09:03:09 pm
or... simpler...
cron job which searches for the z.txt file in the album folder (old and new ones)
(e.g. but not correct because i am no pro: *5 * * * * find . -name 'z.txt' -print0 | xargs -0 cpg/plugins/mass_import/massimport.php?path=)
which sends the folderpath to the php script for adding files (and autocreating folders if not existing)
-> what is the start url for the mass import plugin? like massimport.php?path=$xargs&count=10&continue=1

just some thoughts - maybe someone has an answer....

thx
best regards,
stefan
Title: Re: Plugin that monitors a directory for uploads and automatically adds to gallery
Post by: theramius on February 16, 2013, 10:15:11 pm
..ANY...thoughts? someone?
Title: Re: Plugin that monitors a directory for uploads and automatically adds to gallery
Post by: theramius on March 20, 2013, 11:43:45 pm
no ideas yet?  :'(
Title: Re: Plugin that monitors a directory for uploads and automatically adds to gallery
Post by: roger_morgan on April 05, 2013, 12:35:59 pm
It is actually not too difficult, sorry I don't often look at the cpg forums so I did not respond earlier.

Firstly install the "mass-import" plugin http://forum.coppermine-gallery.net/index.php?topic=61281.0

I personally create a named subdirectory under ..../albums

eg you need albums or a main category say "cats" then create         ...path_to_coppermine.../albums/cats

then create subfolders as required for each further sub-category eg   ...path_to_coppermine.../albums/cats/siamese

into these subfolders load via your favourite ftp prog the pictures and/or documents you need

then climb in as a site administrator and activate the mass-import plug-in.

The automatic stuff will have to be you as a human! ie. when you know pictures have been uploaded, you call up (via the admin back-end) the mass-import.

There is a command line version somewhere of this mass-import which could be started by a 'Unix/Linux' machine every night if you can wait that long.

Hope this helps

Roger Morgan
Title: Re: Plugin that monitors a directory for uploads and automatically adds to gallery
Post by: theramius on April 07, 2013, 11:27:34 pm
hi

thank you very much  :)
i will try to find the command line version

best regards,
stefan