Blog

Sort your Flickr photostream

Flickr has a limitation that your photostream is ordered by the date you uploaded your photos, and this order can’t be changed. If you’ve done a big import of photos – say, from iPhoto – then they could show up in your photostream in any order.

There’s been some talk about the issue, with one suggested solution being to manually set the ‘posted’ date of every photo to the ‘taken’ date. A utility exists to do this, but it has some major limitations, including a difficult user interface and limitation that causes the process to fail if you have any photos that were taken before the date you set up your Flickr account.

So, I’ve made a utility specifically for sorting a Flickr photostream. It should be fairly user friendly, and provides the ability to backup and restore your photo metadata, in case you ever want to revert.

Check it out here: SortMyPhotostream

200906081230.jpg

Leave a comment below if it’s useful to you.

Related posts

Tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

23 Comments

  1. Pepijn
    Posted June 9, 2009 at 1:38 am | Permalink

    Hi Michael, Great idea! However don't seem to get it working though… :-( I'm keep getting this error message: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 35 bytes) in /home/tysonid/public_html/sortmyphotostream/apply.php on line 84 Any idea what this means? Thanks, Pepijn.

  2. Markus
    Posted June 10, 2009 at 5:52 am | Permalink

    Great idea and we included it in our Flickr-related blog in German: http://flickrbuch.wordpress.com/2009/06/09/flickr-fotostream-automatisch-nach-aufnahmedatum-sortieren/

  3. Ken
    Posted June 10, 2009 at 1:42 pm | Permalink

    Looks great… downloaded the source and played around with it. I too was getting the memory error. Tracked it down to the limitation on flickr.photos.search api call of a max of 500 photos. I edited the call to limit based on tag – if I got a response that had more than 500 items in it, I'd run out of memory (no matter my PHP server settings). If I added the 'page' attribute and dropped the per_page to 499 it would work – but had to do it for each page. The following would work: 'page' => 2, 'per_page' => 499, but this did not: 'page' => 2, 'per_page' => 500, Using the API explorer (http://www.flickr.com/services/api/explore/) for that method it worked to get more than 500 back. I'm guessing it has something to do with the line: while ( count($result['photo']) == 500 ); Haven't had time to debug that yet. Great tool though and it's been fun "getting it working"!! Thanks for the code…..

  4. Ken
    Posted June 10, 2009 at 3:52 pm | Permalink

    Some other minor changes

    Changed the apply.php to: <code>$date = $photo['datetaken'];

    $unix_date = strtotime($date);</code>

    Not sure why it comes back as datetaken when you 'pop' it as date_taken, but it does. Then need to convert the date to unix because the setDates function requires Unix timestamp. Still haven't worked out the > 500 issues, but doing it in chunks with min_taken_date and max_taken_date in conjunction with page tags. hope this is helpful….

  5. Posted June 10, 2009 at 6:49 pm | Permalink

    Hi guys!
    My bad about the memory issue – that should be fixed now (I'm processing 500 photos at a time now, which makes much more sense than loading them all, then processing)

    Ken: That's interesting, why the addition of strtotime? Was the API returning dates in string format, not timestamps any more?

  6. Ken
    Posted June 10, 2009 at 10:02 pm | Permalink

    For some reason it was returning a string date – but didn’t know this until I trapped the error… Not sure if it’s new or my implementation of it. Also, forgot that I added the API_TOKEN to star ($flickr->setToken(API_TOKEN);) – for some reason it wasn’t allowing my auth through Flickr….

    What was it that you changed for the memory issue? I upped my php settings to 128M and still ran out of memory… (in the config.inc.php, I added ini_set(‘memory_limit’, 128 * 1024 * 1024);)

    • Posted June 16, 2009 at 7:31 pm | Permalink

      I was being very silly and loaded a list of all photos first, then processed them afterwards. Now, instead, I just do 500 at a time =)

  7. Sarah
    Posted July 6, 2009 at 5:13 am | Permalink

    I tried your tool, but for some reason it set the upload date for every photo to January 22, 2006. There is clearly a date taken for all of the pictures (or 95% of them) that is more recent than that. Not sure what happened, not a huge deal, since it didn’t actually change the order they are in (still in the same order as before, just with a new date uploaded that is not what it used to be, and not the same as the date taken), but I wanted to let you know. My photostream is at: http://www.flickr.com/photos/sarahandadam/ Please let me know if there is anything else I can do to make the tool work for me! Thanks!

    • Posted July 6, 2009 at 11:03 am | Permalink

      Hello, There’s a chance that I need to do some more careful date formatting when setting the posted date – Try now and let me know if it works!

  8. Sim1
    Posted July 20, 2009 at 3:48 pm | Permalink

    I got an error trying to restore my back up file. Is there anything I can do?

  9. Posted July 27, 2009 at 3:11 am | Permalink

    same problem here. I got all my upload dates changed to april 2009.

    thanks

  10. hiroam
    Posted January 8, 2010 at 7:51 am | Permalink

    GREAT!! THANKS A LOT!! (In Japanese, 2Bytes OK)

  11. Su Wei-Chieh
    Posted February 24, 2010 at 2:53 am | Permalink

    Tested and works for me! Many thanks! Do you mind that I intro this tool on a Chinese forum from Taiwan? link: http://www.mobile01.com/topicdetail.php?f=164&t=1266956&p=1#17714294#17714294

    • Posted February 24, 2010 at 2:34 pm | Permalink

      Not at all, Su, go ahead – glad it works for you!

      • Su Wei-Chieh
        Posted February 25, 2010 at 5:40 am | Permalink

        Hi Michael, Thanks! There is one minor thing: I did not check further about the changed date posted after the process yesterday. Today I found the modified date posted are not as same as the date taken – they were changed to some time around 10/05/2009, while the date taken is 02/14/2010. Anyway the photostream sorted as I want, just let you know maybe you could do some further checking. See below two figures about what I am saying: http://flickr.com/gp/suweijack/0PRj7z

  12. Posted April 3, 2010 at 8:17 pm | Permalink

    Hello Michael, thanks for the tool. Although I just tried it out and it changed the “date picture uploaded” to Sep 21, 2009 for all my photos. Also I made a backup before running the tool, but the restore script produces an “not enough arguments” error, so I can’t restore the metadata either.

    The date taken wasn’t changed (which is good) as you can see in the archives page of my flickr account: http://www.flickr.com/photos/gtasioulis/archives/

    Any idea of how I can fix that? Do you think I should re-run the script again (since the “date taken” metadata is fine) or could you give me a solution on how to make the restore function work so I can make everything look back to how it was before running the script?

    • Posted April 4, 2010 at 4:02 pm | Permalink

      Hi George,

      Sorry to hear it’s not working properly for you; I’m really not sure what it could be, particularly given that it works properly for others – I’m yet to figure out what the factor is that breaks it for some people.

      Do you get any more specific errors when you try to restore?

  13. Posted May 15, 2010 at 1:12 pm | Permalink

    It should be useful change the order to a custom one sorting the thumbnails to the desired order…

    • Posted May 29, 2010 at 2:43 pm | Permalink

      Thanks Fabio – What kind of ordering do you think would be helpful?

  14. Posted June 6, 2010 at 12:25 pm | Permalink

    Hi Michael, any special kind of ordering, but a ui like this: http://davidwalsh.name/dw-content/sort-save.php

    Saving only changed photos will speed-up the saving process especially when the are many photos…

  15. Posted July 10, 2010 at 2:54 am | Permalink

    Thank you!! This is awesome!! Saved me a lot of time too! You rock! :)

  16. Marc
    Posted July 23, 2010 at 7:51 pm | Permalink

    Hey, as always this has been a time saver. I was just wondering if anyone came up with any solutions on the upload date. Mine always sets every photo to Feb. 2, 2010. Other than that it orders correctly.

    • Posted July 23, 2010 at 11:05 pm | Permalink

      That’s, as always, quite bizarre. You don’t, perchance, either have a photostream full of photos taken on that date, or possibly all taken before the date you subscribed to Flickr (if it’s that date)?

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Subscribe without commenting