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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

a recipe for FlickrService on 2.3.1


Go to End


5 Posts   3802 Views

Avatar
Bruce B

Community Member, 164 Posts

19 March 2009 at 2:35pm

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 Ticket #3719

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 Ticket #3512 to Lightwindow.js

Avatar
Matt Howard

Community Member, 3 Posts

19 March 2009 at 5:26pm

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

Community Member, 164 Posts

29 April 2009 at 2:42pm

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

Community Member, 11 Posts

5 December 2009 at 1:41pm

Edited: 05/12/2009 3:52pm

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

Community Member, 21 Posts

7 December 2009 at 8:55am

Edited: 07/12/2009 8:59am

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