Saving Flickr favourites to @ownCloud using @ifttt
Migrating away from dropbox.
Following on from my last post about saving Facebook tagged photos to ownCloud, here’s a plugin that addresses my Flickr favourites rule.
This plugin, when set up on IFTTT, will use exactly the same mechanism to save any public photos I tag as a favourite on Flickr to my owncloud folder.
Here’s my flickrfaves.php
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?php class FlickrFaves extends Plugin { private $owncloud_path = '/path/to/owncloud/server/data/user/files/Ifttt/Flickr/'; private $expected_password = 'passwordforwordpresschannel'; public function execute($plugin, $object, $raw) { if (preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/', $object->description, $matches)) { $url = $matches[1]; $parsed = parse_url($url); if ($object->pass == $this->expected_password) { $filename = basename($parsed['path']); file_put_contents($this->owncloud_path.$filename, file_get_contents($url)); } } return $object; } } |
+1ed this.