Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

a recipe for FlickrService on 2.3.1


Reply

5 Posts   2697 Views

Avatar
Bruce B

19 March 2009 at 2:35pm Community Member, 145 Posts

I finally have FlickrService and a FlickrGallery page running under 2.3.1. Here are all the various steps:

Fix compile error
Change line 159 in FlickrService.php according to [url=http://open.silverstripe.com/ticket/3719]Ticket #3719[/url]

Bypass CMS javascript error
On my system, FlickrGallery_CMS.js causes the wrong fields to be hidden, making the CMS for FlickrGallery unusable.
I commented out line 25 in FlickrGallery.php:

//     Requirements::javascript( 'flickrservice/javascript/FlickrGallery_CMS.js' );

tagged images returned with Username selection
If there is an entry in the tags field in the CMS, all tagged photos will be returned along with the user's photos in 'Photos taken by' is chosen.
FlickrGallery.php line 48 changed to:

$photos = $flickr->getPhotos(NULL, $this->User, $this->NumberToShow, $page, $this->Sortby);

Wrong link back to Flickr page
In the Lightwindow popup, there is a link back to the Flickr page. This doesn't work if we have a user's photos or photoset displayed
In FlickrService.php line 81 is replaced by the following 2 lines:

$pageUrluser_ID = $user_id == "" ? "" : $this->User($user_id);
$results->addImagePageUrl($results->PhotoItems, $pageUrluser_ID); //gets individual image page url


and line 143 is replaced by these 2 lines:

$pageUrluser_ID = $user == "" ? "" : $this->User($user);
$results->addImagePageUrl($results->PhotoItems, $pageUrluser_ID); //gets individual image page url

(note these line numbers may no be exact because of multiple edits to this file)

Lightwindow popups don't work
The standard prototype.js and behaviour.js are conflicting with Lightwindow.

Block them from loading by adding the following immediately above
parent::init();
near the end of FlickrGallery.php

Requirements::block('jsparty/prototype.js');
Requirements::block('jsparty/behaviour.js');
Requirements::block('jsparty/prototype_improvements.js');

Lightwindow popup isn't centred
apply the patch in [url=http://open.silverstripe.com/ticket/3512]Ticket #3512[/url] to Lightwindow.js

Avatar
Matt Howard

19 March 2009 at 5:26pm Community Member, 3 Posts

Bruce,

This help to the community came just at the right moment for me!

Were you able with these fixes to retrieve images from your flickr account by user name? I have been unable to and wondered if you had a hunch about where to start. All I'm getting is "( Photos)".

Thanks!

-Matt

Avatar
Bruce B

29 April 2009 at 2:42pm Community Member, 145 Posts

Matt, Are you still there? I have an answer for your problem, maybe.

FlickrService.php calls RestfulServer.php using a depreciated method. This causes problems if Flickr is inaccessible. We also don't get error messages from Flickr. I have attached two files - FlickrService.php and FlickrGallery.php to address these error handling problems. Replacing these two files in the standard install should give you a functional FlickrGallery in 2.3.1. The only additional requirement is to modify lightwindow.js to fix the ie bug.

With the new files installed, Flickr error messages should be visible on the dev site and to users logged in as administrators.

The code all works but I'm not sure if its up to official SS standards. I haven't ventured into actually uploading my patches to the subversion database.

Avatar
g4m3c4ck

5 December 2009 at 1:41pm (Last edited: 5 December 2009 3:52pm), Community Member, 11 Posts

Wow this took all day to figure out for me for various reasons. The main reason it didn't work is because php5-curl was not installed on my server. The files Bruce B contributed were a big help but the annoying Warning still appears. I am going to look into it but I may lack the skills to fix it. I could only get the desired output I wanted by using the "Photos taken by" option. Seems changes to the Flickr API may have broken the other options. I Hope this helps people.

Also the Close button gets clipped so I found this one to replace it http://www.paulschroeder.co.uk/images/closelabel.gif

Avatar
dconel

7 December 2009 at 8:55am (Last edited: 7 December 2009 8:59am), Community Member, 21 Posts

The only thing that i'm still missing are the "previous" and the "next" buttons. I have tried everything, but it will not work..

Edit: in the lightwindow i mean..