Giter Site home page Giter Site logo

Getting photos within sets about phpflickr HOT 4 OPEN

samwilson avatar samwilson commented on August 25, 2024
Getting photos within sets

from phpflickr.

Comments (4)

samwilson avatar samwilson commented on August 25, 2024

Thanks for trying out this fork! :) It's nice to know it's possibly of use.

I've not yet got to converting photosets.getPhotos to the new class layout, but the old style should work:

$phpFlickr->photosets_getPhotos(72657638907952846)

Do you get any error with that?

from phpflickr.

MartinKlefas avatar MartinKlefas commented on August 25, 2024

I don't seem to get any error or any results!

It's a bit tricky because it's all tied together inside the flogr wrappers, so I've had to add the line
die(var_dump(PhpFlickr->photosets_getPhotos($photosetId)));

in the middle of the function that would usually be returning the set photos.
There's also an error suppression part to flogr, and so I've had to change the error suppression from only reporting E_ERROR to E_WARNING - as commenting it out completely caused nothing to work and still no errors to be thrown!

Anyway, when I do all of that, the page just abruptly ends mid-way through, the last line in the html is a tag, and nothing actually seems to die to the page...

It's been a while by the way - apologies if this was a daft way of getting the information we need - would it help if I shared the "Work In Progress" dropbox folder?

from phpflickr.

MartinKlefas avatar MartinKlefas commented on August 25, 2024

OK - so revisited this and started from scratch with a new project. Index.php ended up being as simple as:

$apiKey = '*****';
$apiSecret = '*****';

require_once 'vendor/autoload.php';
$flickr = new \Samwilson\PhpFlickr\PhpFlickr($apiKey, $apiSecret,true);

echo "<pre>";
#var_dump($flickr->photosets_getList('7394337@N06')); - originally here to check that the photo set ID was correct.
var_dump($flickr->photosets_getPhotos('72157638523485346'));

This results in outputting all the correct information for that particular set - but if I leave out the quote marks around the set ID it returns nothing. I figured maybe this was the problem I was having - the set IDs look like they're numbers - so I modified

public function photosets_getPhotos($photoset_id...

to

public function photosets_getPhotos(String $photoset_id

But then dumping out the photoset_id still gave me the "number-version" 7.2157638523485E+16 I'm at a loss as to how to correct this - but I'm not sure I'll need to...

Because I finally worked out what I was doing wrong in my post above! I changed the line added in the middle of the flogr function function get_set_photos to match the function return:

die(var_dump($this->PhpFlickr->photosets_getPhotos(
                $photosetId,
                $extras ? $extras : 'original_format,date_taken,date_upload',
                $privacyFliter,
                $perPage ? $perPage : $this->paramPerPage,
                $page ? $page : $this->paramPage)));

And this seems to dump out the photoset array in a seemingly suitable format, including an array of 98 photos (excerpt below). Has the results array changed in such a way that flogr might not be able to understand it in some way?

edit:
This seems to be processed by the function: $this->PhpFlickr->buildPhotoURL($photo, "thumbnail") has this been implemented in such a way as to understand the "photo" arrays below?


array(2) {
--
  | ["photoset"]=>
  | array(11) {
  | ["id"]=>
  | string(17) "72157638523485346"
  | ["primary"]=>
  | string(11) "11296522014"
  | ["owner"]=>
  | string(11) "7394337@N06"
  | ["ownername"]=>
  | string(22) "Martin Klefas-Stennett"
  | ["photo"]=>
  | array(98) {
  | [0]=>
  | array(15) {
  | ["id"]=>
  | string(11) "11296522014"
  | ["secret"]=>
  | string(10) "982ce28b7f"
  | ["server"]=>
  | string(4) "5523"
  | ["farm"]=>
  | int(6)
  | ["title"]=>
  | string(8) "DSC_5553"
  | ["isprimary"]=>
  | string(1) "1"
  | ["ispublic"]=>
  | int(1)
  | ["isfriend"]=>
  | int(0)
  | ["isfamily"]=>
  | int(0)
  | ["dateupload"]=>
  | string(10) "1386623432"
  | ["datetaken"]=>
  | string(19) "2013-12-08 21:35:01"
  | ["datetakengranularity"]=>
  | string(1) "0"
  | ["datetakenunknown"]=>
  | int(0)
  | ["originalsecret"]=>
  | string(10) "5ef6ecd195"
  | ["originalformat"]=>
  | string(3) "jpg"
  | }
  | [1]=>
  | array(15) {
  | ["id"]=>
  | string(11) "11296561153"
  | ["secret"]=>
  | string(10) "09a2c92002"
  | ["server"]=>
  | string(4) "3759"
  | ["farm"]=>
  | int(4)
  | ["title"]=>
  | string(8) "DSC_5554"
  | ["isprimary"]=>
  | string(1) "0"
  | ["ispublic"]=>
  | int(1)
  | ["isfriend"]=>
  | int(0)
  | ["isfamily"]=>
  | int(0)
  | ["dateupload"]=>
  | string(10) "1386623436"
  | ["datetaken"]=>
  | string(19) "2013-12-08 21:35:02"
  | ["datetakengranularity"]=>
  | string(1) "0"
  | ["datetakenunknown"]=>
  | int(0)
  | ["originalsecret"]=>
  | string(10) "8ff277ba30"
  | ["originalformat"]=>
  | string(3) "jpg"
  | }

from phpflickr.

MartinKlefas avatar MartinKlefas commented on August 25, 2024

OK - sorry for the repeated posts - I now don't know if this is a change in this fork or a change implemented some time ago that has only come to light since my upgrade.
It seems that the returned photoset array used to contain an element ['photo'] at it's root - but this is now found at ['photoset']['photo']. Changing references to this allows the set page to work properly.

from phpflickr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.