

Photographer.io is now open source - robotmay
http://blog.photographer.io/posts/2013/07/08/were-now-open-source/

======
DigitalSea
I love it when I get to see first-hand how other people have made great
things. I really appreciate the author opening the code up for
Photographer.io.

~~~
marcamillion
Couldn't agree more.

Was just going through the Gemfile, and I love how he broke out the gems in
the various categories - from debugging, to databases, to search, to caching
to everything else.

It just makes the code so much easier to read and understand.

As a result of this repo, I looked into Slim - but the official docs are
awful, so I won't be adopting that any time soon.

But this app is very interesting to read through.

You can tell a lot of work was put into this.

~~~
robotmay
Slim is a bit weird as their old documentation (which I learnt on) was miles
better than the current lot. I'd still recommend it though, and feel free to
ask me any questions if you do give it a go as I've been using it for at least
a year now.

I've only recently started organising my Gemfile like this as I was really
struggling with redundant gems lying around. I'm glad you like it :D

~~~
marcamillion
Congrats on the wonderful job.

So I guess my first question about Slim is how does it work?

For instance, I am trying to figure out how on your home page, you have the
following copy:

 _Upload, organise, and share your photographs alongside others, like Robert
May did with this superb image._

Where 'Robert May' and 'superb image' are dynamic links - that correspond to
the image below it (although maybe you may want to change the copy to "the
superb image below" or something of the sort, because it took me a while to
realize that image showing on the page is the same image you were talking
about and linked. I thought they were 2 different images).

So, I guess just to start off...where is the actual copy of "Upload, organise,
and share your photographs...." actually stored. I don't see that copy in the
.slim file at all. It seems to be abstracted to 'home.blurb' \-
[https://github.com/afternoonrobot/photographer-
io/blob/maste...](https://github.com/afternoonrobot/photographer-
io/blob/master/app/views/pages/home.html.slim#L19)

But I have no idea where that is.

Sorry if this changes the topic a bit, but I am curious.

~~~
robotmay
Ah ha, that's actually not the doing of Slim but rather my usage of I18n, the
localisation system used in Rails. Whenever you see t("something.stuff") or
I18n.t("something.other.stuff") it's looking for those keys in YAML files
under config/locales, primarily in en.yml at the moment. So the text you're
looking for is here: [https://github.com/afternoonrobot/photographer-
io/blob/maste...](https://github.com/afternoonrobot/photographer-
io/blob/master/config/locales/en.yml#L102)

I'm not sure my way's the best, but I'm passing two generated links into that
t() call which are then interpolated into the string in the YAML file.

If you've not used I18n before then it can make the views really confusing to
read through without the text to reference! :)

~~~
marcamillion
Ahhh....right.

I haven't used it much...but that's an interesting take on it.

I've seen it used for date & time localization - not for such heavy copy usage
like this.

Do you profile the site - with say Rack-Mini-Profiler to see what the
performance hit of using I18n like that would be? I don't see it in the
Gemfile, but maybe you are using something else to see what the hit of all
those choices are on your performance?

It seems that it may be an extra tax - even though it is clever and I like
it...just curious what the cost is...and would love to know other non-I18n
ways to achieve that, with say ERB.

~~~
robotmay
I must admit that I haven't looked into the speed side of it too much! I
suspect it's not too bad as the YAML file is loaded once on initialisation
into a hash, which the t() function then retrieves the values from. I'm not
sure if that differs when using a database backend.

One benefit of using Slim here is that it's a bit faster than ERB/HAML (as you
can see in my token biased benchmarks:
[https://speakerdeck.com/robotmay/a-simple-introduction-to-
ef...](https://speakerdeck.com/robotmay/a-simple-introduction-to-effective-
caching-in-ruby-on-rails?slide=22)) so it probably negates any extra time that
might be added by using locales.

There's two main reasons I use locales so heavily:

1\. I like my views to be small and largely free of logic

2\. I'd like to translate the site into other languages, and using locales
from the start makes it much simpler!

------
Andrenid
Wow, I somehow missed this project. Awesome work.

Have been urgently needing an alternate to Flickr/Picasaweb/500px lately and
really haven't liked most the other options out there.

I've signed up for a proper play.

~~~
robotmay
I hadn't been promoting it too much until now as I was waiting to get the
terms of service sorted out (as lots of photographers are rightly protective
of their images).

I'm always keen to hear any feedback you have, and obviously now you can also
help contribute to making it the site you want too :D

~~~
Andrenid
Absolutely. Where did you want suggestions submitted? For example it
definitely needs to let you change settings (license, comments on/off/comment-
topics, etc) on multiple images at once. Like Flickr's batch uploader/editor.

~~~
robotmay
I agree! There's a sorta multiple-editor at the moment but it only lets you
switch collections right now. I'm happy for suggestions to go in GitHub issues
at the moment; I'll tag them appropriately and it'll help me see what needs
doing :D

------
e12e
Oh, this is very nice -- maybe what I need to finally kick the tires of
ruby/rails.

What is the minimum to get this up and running locally for test/dev? I know
this isn't exactly meant for ruby/rails newbies -- but according to a few
searches, (and the readme) it looks like I need:

    
    
        * postgresql 9+
        * redis
        * memcached
        * solr (is it needed for test/dev?)
        * ruby 2.0 and rails 4.0
    

It looks like a sane way to get a rails 4 dev environment for the local user
(on a recent Debian system) is:

    
    
        \curl -L https://get.rvm.io | bash -s stable --rails
    

So, with the various servers installed, should the line above, paired with a
checkout of the repo allow me to do:

    
    
        rails serve
    

And have a look at a local install of this thing?

~~~
robotmay
Sorry for the slow reply! I somehow totally missed this one.

I've just pushed up what are hopefully some useful instructions on getting it
running, so the README should now be a little more helpful:
[https://github.com/afternoonrobot/photographer-
io#developmen...](https://github.com/afternoonrobot/photographer-
io#development)

It's not entirely straightforward to set up, and I must confess that it has
been a while since I did it from scratch. Assuming you already have Ruby
installed, then you would definitely need the following: PostgreSQL 9+
(probably 9.2+), Redis, Memcached. Solr probably won't break anything if it
doesn't exist, except for the search.

If you have any trouble getting it going or need a hand, give me a shout on
Twitter (@robotmay) and I'll open up an IRC channel to help you through it. I
might need to do that anyway actually, as I suspect there'll be a few people
with issues :D

------
ddoolin
This is perfect, thank you so much. Two-fold: I opened my site up, too, though
for different reasons. I'm glad to see I'm not the only one. Mine isn't
anywhere near this awesome, though, and it's just starting! And, I think I'll
be able to learn a lot about the proper way to do things by seeing how you did
things, like different code patterns and development decisions, etc.

Thanks!

~~~
robotmay
If you have any questions then don't hesitate to ask! Some of what I do is a
little different (like using Slim or locales everywhere) and I'm happy to help
explain.

------
jscheel
Congrats on making the decision to open source this. I'm interested to see how
the community will help drive the development of new features. As I'm sure
everyone here knows, saying "no" is crucial. It may be a lot harder to say no
when a pull request is sitting in your inbox. I would suggest spending some
time hammering out a wiki for contribution guidelines, and a development
roadmap. I just signed up for an account, and am very excited to see how this
progresses!

Edit: One other thing - right now, invites get you more uploads. Depending on
how heavy-handed you want to be about good contributions, it might help to
require the invitee to upload at least one picture or recommend at least 3
pictures before the inviter gets their additional uploads. That might slow the
growth too much though. It's definitely a balance.

------
robotmay
If anyone's interested in localising the app for their native language then
please let me know (@robotmay). There's near-complete support for I18n
throughout the entire app and it should, in theory, be quite straightforward.

~~~
jancborchardt
I recommend putting it up on [http://transifex.com](http://transifex.com) for
translation, we use that for ownCloud too. There’s a command-line tool to
update strings and to import new translations, and Transifex is open source as
well.

~~~
robotmay
Sweet, I've not come across that before. I'll sort out an account on there
this evening as it looks really neat. Thanks!

------
camus
nice,that's an awesome project !

