Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Plugin that monitors a directory for uploads and automatically adds to gallery  (Read 7068 times)

0 Members and 1 Guest are viewing this topic.

eadamuk

  • Coppermine newbie
  • Offline Offline
  • Posts: 1

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760

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).
Logged

theramius

  • Coppermine newbie
  • Offline Offline
  • Posts: 13

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
Logged

theramius

  • Coppermine newbie
  • Offline Offline
  • Posts: 13

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
Logged

theramius

  • Coppermine newbie
  • Offline Offline
  • Posts: 13

..ANY...thoughts? someone?
Logged

theramius

  • Coppermine newbie
  • Offline Offline
  • Posts: 13

no ideas yet?  :'(
Logged

roger_morgan

  • Coppermine newbie
  • Offline Offline
  • Posts: 6

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
Logged

theramius

  • Coppermine newbie
  • Offline Offline
  • Posts: 13

hi

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

best regards,
stefan
Logged
Pages: [1]   Go Up
 

Page created in 0.093 seconds with 19 queries.